/* The chat panel docked in the shell's drawer. Palette roles only, so it follows every theme. */

.chat-panel {
    /* Kinds of record chat by tint: appointments blue, worklist green, tasks a blue-red violet. */
    --chat-task-tone: color-mix(in srgb, var(--iws-info-tone) 50%, var(--iws-danger-tone));
    --chat-task-bg: color-mix(in srgb, var(--chat-task-tone) 14%, var(--iws-surface));
    --chat-mine: var(--iws-brand-faint);
    position: relative;
    container-type: inline-size;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    border-left: 1px solid var(--iws-border);
    background: var(--iws-surface);
    color: var(--iws-text);
    font-size: 0.8125rem;
}

.chat-resize {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -3px;
    width: 6px;
    cursor: ew-resize;
    z-index: 2;
}

.chat-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.6rem 0.55rem 0.85rem;
    border-bottom: 1px solid var(--iws-border);
}

.chat-title {
    font-weight: 700;
    font-size: 1.06rem;
    color: var(--iws-heading);
}

.chat-head-gap {
    flex: 1;
}

.chat-discuss {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem;
    border: 0;
    background: transparent;
    color: var(--iws-text-secondary);
    cursor: pointer;
}

.chat-discuss:hover {
    color: var(--iws-brand);
}

.chat-icon-btn {
    flex: none;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: none;
    border-radius: 0.3rem;
    background: transparent;
    color: var(--iws-text-muted);
    cursor: pointer;
}

.chat-icon-btn:hover {
    background: var(--iws-hover);
    color: var(--iws-heading);
}

/* On (following, Format open): the light record tint, not the strong selection fill. */
.chat-icon-btn.is-on,
.chat-icon-btn[aria-pressed="true"] {
    background: var(--iws-info-bg);
    color: var(--iws-info-text);
}

.chat-icon-btn svg {
    display: block;
    width: 0.95rem;
    height: 0.95rem;
}

/* My presence: a small pill with its dot. */
.chat-panel .chat-presence.dxbl-btn,
.chat-panel .chat-presence .dxbl-btn {
    --dxbl-btn-color: var(--iws-text-secondary);
    --dxbl-btn-border-color: var(--iws-border);
    --dxbl-btn-hover-border-color: var(--iws-border-strong);
    --dxbl-btn-border-width: 1px;
    --dxbl-btn-border-radius: 0.75rem;
    --dxbl-btn-padding-x: 0.5rem;
    --dxbl-btn-padding-y: 0.1rem;
    --dxbl-btn-font-size: 0.72rem;
    --dxbl-btn-line-height: 1rem;
    min-height: 0;
    border-style: solid;
}

.chat-presence::before,
.chat-presence .dxbl-btn::before {
    content: "";
    display: inline-block;
    flex: none;
    width: 0.45rem;
    height: 0.45rem;
    margin-right: 0.3rem;
    border-radius: 50%;
    background: var(--iws-muted-tone);
}

.chat-presence .dxbl-btn::before {
    display: none;
}

.chat-presence.is-available::before { background: var(--iws-success-tone); }
.chat-presence.is-away::before { background: var(--iws-warning-tone); }
.chat-presence.is-busy::before,
.chat-presence.is-dnd::before { background: var(--iws-danger-tone); }

.chat-error {
    padding: 0.4rem 0.75rem;
    background: var(--iws-danger-bg);
    color: var(--iws-danger-text);
    border-bottom: 1px solid var(--iws-danger-border);
}

/* Pinned to the panel's last row, the one that stretches: the resize handle is absolute and takes no
   row, so without the error line the body would otherwise fall into the middle, content-high one. */
.chat-body {
    grid-row: 3;
    display: grid;
    grid-template-columns: 14.25rem minmax(0, 1fr);
    min-height: 0;
}

/* ---- The list ---- */

.chat-list {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    min-height: 0;
    border-right: 1px solid var(--iws-border);
    background: var(--iws-surface-subtle);
}

/* The editor's own full width plus these margins overran the column; the grid row sizes it instead. */
.chat-panel .chat-search {
    width: auto;
    min-width: 0;
    margin: 0.55rem 0.55rem 0.2rem;
}

.chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.35rem 0.55rem 0.4rem;
    border-bottom: 1px solid var(--iws-border-subtle);
}

/* DevExpress's theme sheets load after this one, so its buttons are reshaped through the theme's
   own variables, which win whatever order the rules come in. */
.chat-panel .chat-chips .dxbl-btn.chat-chip {
    --dxbl-btn-bg: var(--iws-surface);
    --dxbl-btn-hover-bg: var(--iws-surface);
    --dxbl-btn-active-bg: var(--iws-surface);
    --dxbl-btn-color: var(--iws-text-secondary);
    --dxbl-btn-hover-color: var(--iws-heading);
    --dxbl-btn-active-color: var(--iws-heading);
    --dxbl-btn-border-color: var(--iws-border);
    --dxbl-btn-hover-border-color: var(--iws-border-strong);
    --dxbl-btn-active-border-color: var(--iws-border-strong);
    --dxbl-btn-border-width: 1px;
    --dxbl-btn-border-radius: 0.625rem;
    --dxbl-btn-padding-x: 0.55rem;
    --dxbl-btn-padding-y: 0;
    --dxbl-btn-font-size: 0.69rem;
    --dxbl-btn-font-weight: 600;
    --dxbl-btn-line-height: 1.15rem;
    --dxbl-btn-btn-caption-padding-horizontal: 0;
    --dxbl-btn-btn-caption-padding-top: 0;
    --dxbl-btn-btn-caption-padding-bottom: 0;
    min-height: 0;
    box-shadow: none;
}

.chat-panel .chat-chips .dxbl-btn.chat-chip.is-on {
    --dxbl-btn-bg: var(--iws-accent);
    --dxbl-btn-hover-bg: var(--iws-accent-hover);
    --dxbl-btn-active-bg: var(--iws-accent-hover);
    --dxbl-btn-color: var(--iws-text-on-accent);
    --dxbl-btn-hover-color: var(--iws-text-on-accent);
    --dxbl-btn-active-color: var(--iws-text-on-accent);
    --dxbl-btn-border-color: var(--iws-accent);
    --dxbl-btn-hover-border-color: var(--iws-accent-hover);
    --dxbl-btn-active-border-color: var(--iws-accent-hover);
}

.chat-panel .chat-chips .dxbl-btn.chat-chip.is-mentions::before {
    content: "@";
    margin-right: 0.2rem;
    color: var(--iws-danger-tone);
    font-weight: 800;
}

.chat-panel .chat-chips .dxbl-btn.chat-chip.is-mentions.is-on::before {
    color: inherit;
}

/* Outranks the theme's own `.dxbl-list-box{height:200px}`, which loads later. */
.chat-panel .chat-threads {
    min-height: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
}

/* The list's scrolling body is capped at 200px by the theme. Its border is dropped on both levels:
   the column's own edge already bounds it, and a second line beside it read as a double border. */
.chat-panel .chat-threads,
.chat-panel .chat-threads .dxbl-list-box-render-container {
    --dxbl-list-box-border-width: 0;
    border: 0;
}

.chat-panel .chat-threads .dxbl-list-box-render-container,
.chat-panel .chat-threads > .dxbl-scroll-viewer {
    width: 100%;
    height: 100%;
    max-height: none;
}

.chat-panel .chat-threads [role="option"] {
    padding: 0.4rem 0.55rem;
    border-bottom: 1px solid var(--iws-border-subtle);
}

.chat-panel .chat-threads.chat-threads [role="option"][aria-selected="true"] {
    background: var(--iws-selected);
    box-shadow: inset 3px 0 0 var(--iws-brand);
    color: inherit;
}

.chat-panel .dxbl-btn.chat-browse-link {
    justify-self: start;
    margin: 0.2rem 0.3rem 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    gap: 0.3rem;
}

.chat-browse-link svg {
    width: 0.85rem;
    height: 0.85rem;
}

.chat-row {
    display: grid;
    grid-template-columns: 1.875rem minmax(0, 1fr);
    gap: 0.5rem;
    align-items: center;
    min-width: 0;
    width: 100%;
}

/* The lead mark: a channel's #, a record's tinted square, a person's avatar or a group's stack. */
.chat-row-mark {
    width: 1.75rem;
    height: 1.75rem;
    display: grid;
    place-items: center;
    border-radius: 0.375rem;
    color: var(--iws-text-secondary);
    font-weight: 700;
    font-size: 0.85rem;
}

.chat-row-mark svg {
    width: 0.9rem;
    height: 0.9rem;
}

.chat-row-mark.is-channel {
    background: var(--iws-surface-sunken);
    border: 1px solid var(--iws-border);
}

.chat-row-mark.is-record {
    background: var(--iws-info-bg);
    color: var(--iws-info-text);
}

.chat-row-mark.is-task {
    background: var(--chat-task-bg);
    color: var(--chat-task-tone);
}

.chat-row-mark.is-worklistItem {
    background: var(--iws-success-bg);
    color: var(--iws-success-text);
}

.chat-row-mark.is-stack {
    position: relative;
    display: block;
}

.chat-row-mark.is-stack .chat-avatar {
    position: absolute;
    width: 1.2rem;
    height: 1.2rem;
    font-size: 0.55rem;
    border: 1.5px solid var(--iws-surface);
}

.chat-row-mark.is-stack .chat-avatar:first-child {
    left: 0;
    top: 0;
}

.chat-row-mark.is-stack .chat-avatar:last-child {
    right: 0;
    bottom: 0;
}

.chat-row-main {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.chat-row-top,
.chat-row-bottom {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.chat-row-title,
.chat-row-preview {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-row-title {
    font-size: 0.78rem;
    color: var(--iws-heading);
}

.chat-row.is-unread .chat-row-title {
    font-weight: 700;
}

.chat-row-time {
    flex: none;
    color: var(--iws-text-faint);
    font-size: 0.62rem;
}

.chat-row-preview {
    color: var(--iws-text-muted);
    font-size: 0.7rem;
}

.chat-row.is-unread .chat-row-preview {
    color: var(--iws-text);
}

.chat-row-at {
    flex: none;
    width: 0.95rem;
    height: 0.95rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--iws-danger-tone);
    color: var(--iws-text-on-accent);
    font-size: 0.6rem;
    font-weight: 800;
}

.chat-row-unread {
    flex: none;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--iws-brand);
}

.chat-avatar {
    position: relative;
    flex: 0 0 auto;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    color: #fff;
    font-size: 0.66rem;
    font-weight: 700;
}

.chat-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--iws-muted-tone);
    border: 2px solid var(--iws-surface);
    box-sizing: content-box;
}

.chat-avatar .chat-dot {
    position: absolute;
    right: -0.15rem;
    bottom: -0.15rem;
}

.chat-dot.is-available { background: var(--iws-success-tone); }
.chat-dot.is-away { background: var(--iws-warning-tone); }
.chat-dot.is-busy,
.chat-dot.is-dnd { background: var(--iws-danger-tone); }

.chat-empty,
.chat-pick {
    padding: 1rem;
    color: var(--iws-text-faint);
    text-align: center;
}

.chat-pick {
    align-self: center;
}

.chat-new-empty .chat-empty {
    max-width: 16rem;
    font-size: 0.72rem;
    line-height: 1.4;
}

/* ---- The conversation ---- */

.chat-side {
    display: grid;
    min-height: 0;
    min-width: 0;
}

/* A column whose message list takes the room, however many strips sit above it (people picker,
   replies head, the new-chat fields), so the composer always rests on the panel's floor. */
.chat-conv {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-conv > * {
    flex: 0 0 auto;
}

.chat-conv > .chat-messages,
.chat-conv > .chat-browse {
    flex: 1 1 auto;
    min-height: 0;
}

.chat-conv-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--iws-border);
    min-width: 0;
}

.chat-back {
    display: none;
}

.chat-conv-titles {
    display: grid;
    flex: 1;
    min-width: 0;
}

.chat-conv-title {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--iws-heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-conv-sub {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    min-width: 0;
    color: var(--iws-text-muted);
    font-size: 0.66rem;
}

.chat-conv-line {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-member {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.chat-member .chat-dot {
    width: 0.4rem;
    height: 0.4rem;
    border-width: 0;
}

/* The record's Open: a small light-bordered button, 22px tall like the pill beside it. */
.chat-panel .dxbl-btn.chat-open {
    --dxbl-btn-bg: var(--iws-surface);
    --dxbl-btn-color: var(--iws-heading);
    --dxbl-btn-border-color: var(--iws-border-strong);
    --dxbl-btn-hover-bg: var(--iws-hover);
    --dxbl-btn-hover-color: var(--iws-heading);
    --dxbl-btn-hover-border-color: var(--iws-border-strong);
    --dxbl-btn-padding-x: 0.5rem;
    --dxbl-btn-padding-y: 0.125rem;
    --dxbl-btn-font-size: 0.66rem;
    --dxbl-btn-font-weight: 500;
    --dxbl-btn-line-height: 1rem;
    min-height: 0;
    gap: 0.25rem;
    border-color: var(--iws-border-strong);
    background: var(--iws-surface);
    color: var(--iws-heading);
    font-size: 0.66rem;
    font-weight: 500;
}

.chat-panel .dxbl-btn.chat-open:hover {
    background: var(--iws-hover);
}

/* The record card over a record chat: who and what, its step, and the ways to it. */
.chat-rec-card {
    display: grid;
    gap: 0.15rem;
    margin: 0.6rem 0.6rem 0.5rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--iws-border);
    border-radius: 0.375rem;
    background: var(--iws-tint);
    color: var(--iws-text);
    font-size: 0.69rem;
}

.chat-rec-card-line {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-rec-card-line b {
    color: var(--iws-heading);
}

.chat-rec-card-status {
    color: var(--iws-text-secondary);
}

.chat-rec-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.3rem;
}

.chat-panel .dxbl-btn.chat-rec-go {
    --dxbl-btn-padding-x: 0.5rem;
    --dxbl-btn-padding-y: 0.125rem;
    --dxbl-btn-font-size: 0.66rem;
    --dxbl-btn-font-weight: 500;
    --dxbl-btn-line-height: 1rem;
    min-height: 0;
    gap: 0.25rem;
    font-size: 0.66rem;
}

.chat-rec-go svg {
    width: 0.75rem;
    height: 0.75rem;
}

.chat-rec-card + .chat-conv-head {
    border-top: 1px solid var(--iws-border);
}

.chat-open svg {
    width: 0.75rem;
    height: 0.75rem;
}

/* Who can read: Private · n with a lock, or Public. */
.chat-panel .chat-vis.dxbl-btn,
.chat-panel .chat-vis .dxbl-btn {
    --dxbl-btn-bg: var(--iws-surface);
    --dxbl-btn-color: var(--iws-text-secondary);
    --dxbl-btn-border-color: var(--iws-border);
    --dxbl-btn-border-radius: 0.625rem;
    --dxbl-btn-padding-x: 0.5rem;
    --dxbl-btn-padding-y: 0.1rem;
    --dxbl-btn-font-size: 0.66rem;
    --dxbl-btn-font-weight: 600;
    --dxbl-btn-line-height: 1rem;
}

.chat-vis,
.chat-panel .chat-vis.dxbl-btn,
.chat-panel .chat-vis .dxbl-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-height: 0;
    padding: 0.1rem 0.5rem;
    border: 1px solid var(--iws-border);
    border-radius: 0.625rem;
    background: var(--iws-surface);
    color: var(--iws-text-secondary);
    font-size: 0.66rem;
    font-weight: 600;
    white-space: nowrap;
}

.chat-vis svg,
.chat-vis-lock {
    width: 0.7rem;
    height: 0.7rem;
}

.chat-vis-lock {
    display: inline-block;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 11H19V21H5Z M7.5 11V8A4.5 4.5 0 0 1 16.5 8V11H14.5V8A2.5 2.5 0 0 0 9.5 8V11Z'/%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='M5 11H19V21H5Z M7.5 11V8A4.5 4.5 0 0 1 16.5 8V11H14.5V8A2.5 2.5 0 0 0 9.5 8V11Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.chat-adding,
.chat-new {
    display: grid;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--iws-border-subtle);
}

.chat-messages {
    overflow-y: auto;
    min-height: 0;
    padding: 0.75rem 0.9rem 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.chat-older {
    align-self: center;
}

.chat-divider {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.35rem 0;
    color: var(--iws-danger-tone);
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chat-divider::before,
.chat-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--iws-danger-border);
}

.chat-msg {
    position: relative;
    display: grid;
    grid-template-columns: 1.75rem minmax(0, 1fr);
    gap: 0.6rem;
    padding: 0.3rem 0.4rem;
    border-radius: 0.375rem;
}

.chat-msg:hover {
    background: var(--iws-surface-subtle);
}

.chat-msg.mentions-me {
    background: var(--iws-warning-bg);
    box-shadow: inset 3px 0 0 var(--iws-warning-tone);
}

.chat-msg.is-sending .chat-msg-main {
    opacity: 0.6;
}

.chat-msg-main {
    min-width: 0;
}

.chat-msg-head {
    display: flex;
    gap: 0.45rem;
    align-items: baseline;
    margin-bottom: 0.1rem;
}

.chat-msg-author {
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--iws-heading);
}

.chat-msg-time,
.chat-msg-edited {
    color: var(--iws-text-faint);
    font-size: 0.62rem;
}

.chat-msg-body {
    overflow-wrap: anywhere;
    line-height: 1.45;
}

.chat-msg.is-mine .chat-msg-body:not(.is-retracted) {
    display: inline-block;
    max-width: 100%;
    padding: 0.35rem 0.6rem;
    border-radius: 0 0.5rem 0.5rem 0.5rem;
    background: var(--chat-mine);
}

.chat-msg-body p {
    margin: 0;
}

.chat-msg-body.is-retracted {
    color: var(--iws-text-faint);
    font-style: italic;
}

.chat-msg-body .dx-mention,
.chat-msg-body .mention {
    padding: 0 0.15rem;
    border-radius: 0.2rem;
    background: var(--iws-brand-faint);
    color: var(--iws-brand-text);
    font-weight: 600;
}

.chat-quote {
    margin: 0.1rem 0 0.3rem;
    padding: 0.25rem 0.55rem;
    border-left: 3px solid var(--iws-border-strong);
    border-radius: 0 0.25rem 0.25rem 0;
    background: var(--iws-surface-subtle);
    color: var(--iws-text-secondary);
    font-size: 0.72rem;
}

.chat-reactions,
.chat-react-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.3rem;
}

.chat-reaction {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid var(--iws-border);
    border-radius: 0.625rem;
    background: var(--iws-surface);
    padding: 0 0.45rem;
    font-size: 0.72rem;
    line-height: 1.25rem;
    color: var(--iws-text-secondary);
    cursor: pointer;
}

.chat-reaction:hover {
    border-color: var(--iws-border-strong);
}

.chat-reaction.is-mine {
    border-color: var(--iws-brand);
    background: var(--iws-brand-faint);
    color: var(--iws-brand-text);
}

.chat-thread-link {
    padding: 0;
    font-size: 0.72rem;
}

/* On hover, as Teams: quick reactions | Reply, Edit | ⋯ with every action by name. Narrower, the
   reactions fold into one smile, then the shortcuts leave the ⋯ alone. */
.chat-messages {
    container-type: inline-size;
}

.chat-msg-actions {
    position: absolute;
    top: -0.7rem;
    right: 0.5rem;
    display: none;
    align-items: center;
    gap: 0.05rem;
    padding: 0.1rem;
    border: 1px solid var(--iws-border);
    border-radius: 0.375rem;
    background: var(--iws-surface);
    box-shadow: var(--iws-shadow);
    z-index: 1;
}

.chat-msg:hover .chat-msg-actions,
.chat-msg:focus-within .chat-msg-actions,
.chat-msg.is-menu-open .chat-msg-actions {
    display: flex;
}

.chat-act-emojis {
    display: contents;
}

.chat-msg-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.3rem;
    border-radius: 0.25rem;
    cursor: pointer;
    color: var(--iws-text-secondary);
    font-size: 0.85rem;
    line-height: 1;
}

.chat-msg-actions button.is-emoji {
    padding: 0 0.2rem;
}

.chat-msg-actions button:hover,
.chat-msg.is-menu-open .chat-act-more {
    background: var(--iws-hover);
    color: var(--iws-heading);
}

.chat-msg-actions button svg {
    display: block;
    width: 0.85rem;
    height: 0.85rem;
}

.chat-msg-actions .chat-act-more {
    font-weight: 800;
    letter-spacing: 0.02em;
}

.chat-act-sep {
    align-self: stretch;
    width: 1px;
    margin: 0.2rem 0.2rem;
    background: var(--iws-border);
}

.chat-msg-actions .chat-act-react {
    display: none;
}

@container (max-width: 20rem) {
    .chat-act-emojis {
        display: none;
    }

    .chat-msg-actions .chat-act-react {
        display: inline-flex;
    }
}

@container (max-width: 13rem) {
    .chat-msg-actions .chat-act-shortcut {
        display: none;
    }
}

.chat-msg-menu-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-msg-menu-item svg {
    display: block;
    width: 0.85rem;
    height: 0.85rem;
    color: var(--iws-text-secondary);
}

.chat-msg-menu .is-danger .chat-msg-menu-item,
.chat-msg-menu .is-danger .chat-msg-menu-item svg {
    color: var(--iws-danger-tone);
}

.chat-task-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.3rem;
    padding: 0.15rem 0.5rem;
    border: 1px solid color-mix(in srgb, var(--chat-task-tone) 35%, var(--iws-surface));
    border-radius: 0.3rem;
    background: var(--chat-task-bg);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--chat-task-tone);
    text-decoration: none;
}

.chat-task-link svg {
    width: 0.8rem;
    height: 0.8rem;
}

.chat-task-link:hover {
    border-color: var(--chat-task-tone);
}

.chat-link-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 100%;
    margin-top: 0.3rem;
    padding: 0.15rem 0.5rem;
    border: 1px solid color-mix(in srgb, var(--iws-link) 35%, var(--iws-surface));
    border-radius: 0.3rem;
    background: color-mix(in srgb, var(--iws-link) 8%, var(--iws-surface));
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--iws-link);
    text-decoration: none;
}

.chat-link-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-link-chip svg {
    flex: none;
    width: 0.85rem;
    height: 0.85rem;
}

.chat-link-chip:hover {
    border-color: var(--iws-link);
    background: color-mix(in srgb, var(--iws-link) 14%, var(--iws-surface));
}

.chat-link-chip:hover span {
    text-decoration: underline;
}

.chat-link-dialog {
    display: grid;
    gap: 0.6rem;
}

.chat-link-options {
    max-height: 18rem;
}

.chat-link-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.chat-link-option span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-link-option svg {
    flex: none;
    width: 0.85rem;
    height: 0.85rem;
}

.chat-files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.3rem;
}

.chat-file-image {
    padding: 0;
    border: 1px solid var(--iws-border);
    border-radius: 0.375rem;
    background: var(--iws-surface-subtle);
    overflow: hidden;
    cursor: zoom-in;
}

.chat-file-image img {
    display: block;
    width: 11.875rem;
    height: 6.875rem;
    object-fit: cover;
}

.chat-file-loading {
    width: 6rem;
    height: 4.5rem;
    display: grid;
    place-items: center;
    color: var(--iws-text-faint);
}

.chat-file-card {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    width: 15.625rem;
    max-width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--iws-border);
    border-radius: 0.375rem;
    background: var(--iws-surface);
    color: var(--iws-text);
    text-align: left;
    cursor: pointer;
}

.chat-file-card:hover {
    border-color: var(--iws-brand);
}

.chat-file-card svg,
.chat-file-loading svg,
.chat-pending-file svg {
    flex: none;
    width: 1rem;
    height: 1rem;
    color: var(--iws-brand);
}

.chat-file-card > svg {
    box-sizing: content-box;
    padding: 0.35rem;
    border-radius: 0.25rem;
    background: var(--iws-brand-faint);
}

.chat-file-text {
    display: grid;
    min-width: 0;
}

.chat-file-name,
.chat-pending-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-file-name {
    font-weight: 600;
    font-size: 0.75rem;
}

.chat-file-text small,
.chat-pending-file small {
    color: var(--iws-text-faint);
    font-size: 0.66rem;
}

.chat-pending {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.chat-pending-file {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 14rem;
    padding: 0.05rem 0.1rem 0.05rem 0.45rem;
    border: 1px solid var(--iws-border);
    border-radius: 0.625rem;
    font-size: 0.72rem;
}

.chat-pending-file .chat-icon-btn {
    width: 1.3rem;
    height: 1.3rem;
}

.chat-pending-file .chat-icon-btn svg {
    width: 0.65rem;
    height: 0.65rem;
    color: inherit;
}

.chat-pending-file.is-uploading {
    padding-right: 0.45rem;
    color: var(--iws-text-secondary);
}

.chat-attach:disabled {
    opacity: 0.45;
    cursor: default;
}

.chat-composer.is-dragging {
    outline: 2px dashed var(--iws-brand);
    outline-offset: -4px;
}

.chat-confirm {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.3rem;
}

.chat-system {
    align-self: center;
    margin: 0.3rem 0;
    padding: 0.15rem 0.7rem;
    border: 1px solid var(--iws-border-subtle);
    border-radius: 0.625rem;
    background: var(--iws-surface-subtle);
    color: var(--iws-text-muted);
    font-size: 0.68rem;
    text-align: center;
}

.chat-replies-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    font-weight: 700;
    border-bottom: 1px solid var(--iws-border-subtle);
}

.chat-replies {
    margin-left: 2.35rem;
    border-left: 2px solid var(--iws-border-subtle);
    padding-left: 0.5rem;
}

/* ---- The composer ---- */

.chat-composer {
    border-top: 1px solid var(--iws-border);
    padding: 0.5rem 0.9rem 0.55rem;
    display: grid;
    gap: 0.35rem;
}

.chat-compose-target {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--iws-text-secondary);
    font-size: 0.72rem;
}

.chat-compose-ctx {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

/* The composer's pills stay compact: one 22px line of small text, so they never crowd the box. */
.chat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    box-sizing: border-box;
    height: 1.375rem;
    padding: 0 0.5rem;
    border: 1px solid var(--iws-border-strong);
    border-radius: 0.6875rem;
    background: var(--iws-surface);
    color: var(--iws-text-secondary);
    font-size: 0.66rem;
    line-height: 1;
    white-space: nowrap;
}

button.chat-pill {
    cursor: pointer;
}

button.chat-pill:hover {
    background: var(--iws-hover);
    color: var(--iws-heading);
}

button.chat-pill.is-on {
    border-color: var(--iws-brand);
    color: var(--iws-brand);
    font-weight: 600;
}

.chat-pill svg {
    display: block;
    width: 0.7rem;
    height: 0.7rem;
}

/* Make it a task: dashed while off, filled violet once on. */
.chat-task-toggle {
    padding-left: 0.3rem;
    border-style: dashed;
    background: transparent;
}

.chat-task-toggle.is-on {
    border: 1px solid var(--chat-task-tone);
    background: var(--chat-task-bg);
    color: var(--chat-task-tone);
    font-weight: 600;
}

.chat-task-toggle .dxbl-checkbox {
    font-size: inherit;
    color: inherit;
}

.chat-task-toggle .dxbl-checkbox.dxbl-checkbox-switch {
    --dxbl-checkbox-padding: 0;
    --dxbl-checkbox-check-element-width: 1.375rem;
    --dxbl-checkbox-check-element-height: 0.75rem;
    --dxbl-checkbox-check-element-switch-trigger-width: 0.5rem;
    --dxbl-checkbox-check-element-switch-trigger-height: 0.5rem;
    --dxbl-checkbox-check-element-switch-margin: 0.125rem;
}

.chat-compose-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 0.3rem;
    padding: 0.2rem 0.3rem 0.2rem 0.2rem;
    border: 1px solid var(--iws-border);
    border-radius: 0.375rem;
    background: var(--iws-surface);
}

.chat-compose-box:focus-within {
    border-color: var(--iws-focus);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--iws-focus) 18%, transparent);
}

/* The editor's announcements for screen readers ("Items: 2" under the @ list). The class is
   DevExtreme's, whose own sheet is not loaded with the Blazor theme, so nothing hid them. Global: the
   list is an overlay that may be moved out of the composer while it is open. */
.dx-screen-reader-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* The compose box draws the one frame and its focus ring; the editor's own border, and the primary
   one the theme puts on its typing area while focused, would be a second box inside it. */
.chat-editor .dxbl-html-editor,
.chat-editor .dxbl-html-editor .dx-htmleditor,
.chat-editor .dxbl-html-editor .dx-htmleditor.dx-state-focused {
    border: none;
    box-shadow: none;
    background: transparent;
}

/* The compact box shows no toolbar; Format brings it. The editor has no switch for its bar, so it is
   hidden here — and the bar is drawn by the Office ribbon root, not the DevExtreme toolbar wrapper.
   Lifted out of the flow, unseen, rather than `display:none`: the bar decides which groups to fold
   into "…" by measuring its width, and measured at 0 wide it folds every group and stays folded
   once Format shows it. The ribbon root is `display:contents`, so the rule sits on the bar inside. */
.chat-editor .dxbl-html-editor {
    position: relative;
    --dxbl-html-editor-content-padding-x: 3px;
    --dxbl-html-editor-content-padding-y: 3px;
    --dxbl-html-editor-placeholder-offset: 3px;
}

.chat-composer:not(.is-expanded) .chat-editor .dxbl-ribbon__root > .dxbl-ribbon,
.chat-composer:not(.is-expanded) .chat-editor .dx-htmleditor-toolbar-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    visibility: hidden;
    pointer-events: none;
}

/* The bar at the suite's small size, as the chart's Documentation editor has it: the editor carries
   `dxbl-sm`, which sizes the icons, and these are `.dxbl-toolbar.dxbl-sm`'s own metrics, which the
   class on the host does not reach. */
.chat-editor .dxbl-toolbar {
    --dxbl-toolbar-font-size: .75rem;
    --dxbl-toolbar-line-height: 1.5;
    --dxbl-toolbar-btn-border-radius: .125rem;
    --dxbl-toolbar-btn-padding-x: .25rem;
    --dxbl-toolbar-btn-padding-y: .1875rem;
    --dxbl-toolbar-group-spacing: .5rem;
    --dxbl-toolbar-item-spacing: .1875rem;
}

/* One 3px inset round the buttons: the bar's own, with none on the toolbar around it. */
.chat-editor .dxbl-ribbon__root {
    --dxbl-ribbon-adaptive-toolbar-padding-x: 0;
    --dxbl-ribbon-adaptive-toolbar-padding-y: 0;
    --dxbl-ribbon-adaptive-toolbar-margin-bottom: 0;
    --dxbl-ribbon-adaptive-container-padding: 3px;
    --dxbl-ribbon-adaptive-container-padding-y: 3px;
    --dxbl-ribbon-group-separator-height: 1.25rem;
}

/* The measuring clone, as wide as the buttons it measures rather than the narrow composer. */
.chat-editor .dxbl-adaptive-virtual-container {
    width: max-content;
    max-width: none;
}

/* The typing area takes whatever height the bar leaves, so it is never a sliver under it. */
.chat-editor .dxbl-html-editor {
    display: flex;
    flex-direction: column;
}

.chat-editor .dxbl-html-editor > .dxbl-widget-container {
    flex: 1 1 auto;
    min-height: 0;
}

/* Format, attach and @ in a small row over Send, which spans the row's width. */
.chat-compose-tools {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding-bottom: 0.15rem;
}

.chat-compose-extras {
    display: flex;
    align-items: center;
    gap: 0.1rem;
}

.chat-compose-extras .chat-icon-btn {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.25rem;
}

.chat-compose-extras .chat-icon-btn svg {
    width: 0.75rem;
    height: 0.75rem;
}

.chat-at {
    font-weight: 700;
    font-size: 0.75rem;
    line-height: 1;
}

.chat-panel .dxbl-btn.chat-send {
    --dxbl-btn-padding-x: 0;
    --dxbl-btn-padding-y: 0;
    --dxbl-btn-border-radius: 0.3rem;
    width: auto;
    height: 1.75rem;
    min-height: 0;
    justify-content: center;
}

.chat-send svg {
    width: 0.85rem;
    height: 0.85rem;
}

.chat-compose-hint {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--iws-text-faint);
    font-size: 0.62rem;
}

.chat-compose-readers {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- New chat, pickers, browse ---- */

/* The To line is one box: the people picked so far as tags, then the search typed after them. The
   picker's matches drop over the form below, and only while the box has focus. */
.chat-to-box {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    box-sizing: border-box;
    min-height: var(--iws-control-height);
    padding: 0.15rem 0.4rem;
    border: 1px solid var(--iws-border);
    border-radius: 0.25rem;
    background: var(--iws-surface);
}

.chat-to-box:focus-within {
    border-color: var(--iws-focus);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--iws-focus) 18%, transparent);
}

.chat-to-label {
    color: var(--iws-text-faint);
    font-size: 0.69rem;
}

.chat-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    height: 1.25rem;
    padding: 0 0.5rem;
    border: 1px solid var(--iws-border);
    border-radius: 0.625rem;
    background: var(--iws-surface);
    color: var(--iws-text-secondary);
    font-size: 0.66rem;
    white-space: nowrap;
}

.chat-tag button {
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--iws-text-secondary);
}

.chat-to-box .chat-picker {
    display: contents;
}

.chat-panel .chat-to-box .chat-picker-box {
    --dxbl-text-edit-border-width: 0;
    --dxbl-text-edit-focus-border-color: transparent;
    flex: 1 1 6rem;
    height: calc(var(--iws-control-height) - 2px - 0.3rem);
    min-width: 6rem;
    background: transparent;
    box-shadow: none;
}

.chat-to-box .chat-picker-results {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: -1px;
    right: -1px;
    z-index: 5;
    background: var(--iws-surface);
    box-shadow: 0 6px 18px rgb(0 0 0 / 0.14);
}

.chat-to-box:not(:focus-within) .chat-picker-results {
    display: none;
}

/* A field with its caption above it, as the mockup's small upper-case labels. */
.chat-field {
    display: grid;
    gap: 0.15rem;
}

.chat-field-caption {
    color: var(--iws-text-faint);
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.chat-vis-choice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.chat-panel .chat-vis-choice .dxbl-btn.chat-vis-opt {
    --dxbl-btn-bg: var(--iws-surface);
    --dxbl-btn-hover-bg: var(--iws-hover);
    --dxbl-btn-active-bg: var(--iws-hover);
    --dxbl-btn-color: var(--iws-text-secondary);
    --dxbl-btn-hover-color: var(--iws-heading);
    --dxbl-btn-active-color: var(--iws-heading);
    --dxbl-btn-border-color: var(--iws-border);
    --dxbl-btn-hover-border-color: var(--iws-border-strong);
    --dxbl-btn-active-border-color: var(--iws-border-strong);
    --dxbl-btn-border-radius: 0.3125rem;
    --dxbl-btn-padding-x: 0.65rem;
    --dxbl-btn-padding-y: 0;
    --dxbl-btn-font-size: 0.72rem;
    --dxbl-btn-line-height: 1.375rem;
    gap: 0.35rem;
    min-height: 0;
    box-shadow: none;
}

.chat-panel .chat-vis-choice .dxbl-btn.chat-vis-opt.is-on {
    --dxbl-btn-bg: var(--iws-selected);
    --dxbl-btn-hover-bg: var(--iws-selected);
    --dxbl-btn-active-bg: var(--iws-selected);
    --dxbl-btn-color: var(--iws-heading);
    --dxbl-btn-hover-color: var(--iws-heading);
    --dxbl-btn-border-color: var(--iws-focus);
    --dxbl-btn-hover-border-color: var(--iws-focus);
    --dxbl-btn-active-border-color: var(--iws-focus);
    --dxbl-btn-font-weight: 700;
}

.chat-vis-opt svg {
    width: 0.75rem;
    height: 0.75rem;
}

.chat-vis-hint {
    color: var(--iws-text-faint);
    font-size: 0.62rem;
}

.chat-conv > .chat-messages.chat-new-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--iws-text-faint);
    font-size: 0.69rem;
}

.chat-picker {
    display: grid;
    gap: 0.25rem;
}

.chat-picker-results {
    display: grid;
    max-height: 12rem;
    overflow-y: auto;
    border: 1px solid var(--iws-border-subtle);
    border-radius: 0.35rem;
}

.chat-picker-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: var(--iws-text);
}

.chat-picker-item:hover {
    background: var(--iws-hover);
}

.chat-picker-status {
    flex: none;
    margin-left: auto;
    color: var(--iws-text-faint);
    font-size: 0.72rem;
}

.chat-picker-results {
    container-type: inline-size;
}

.chat-picker-name {
    flex: none;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The person's roles: the first thing to give way, truncated before the name and gone when the list is narrow. */
.chat-picker-group {
    min-width: 0;
    margin-left: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--iws-text-faint);
    font-size: 0.72rem;
}

.chat-picker-group + .chat-picker-status {
    margin-left: 0;
}

@container (max-width: 17rem) {
    .chat-picker-group {
        display: none;
    }

    .chat-picker-group + .chat-picker-status {
        margin-left: auto;
    }
}

.chat-browse {
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    display: grid;
    align-content: start;
    gap: 0.4rem;
}

.chat-browse-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-browse-row svg {
    width: 1rem;
    height: 1rem;
    color: var(--iws-text-secondary);
}

.chat-browse-name {
    display: grid;
    flex: 1;
    min-width: 0;
}

.chat-browse-name span {
    color: var(--iws-text-faint);
    font-size: 0.72rem;
}

.chat-browse-create {
    margin: 0.75rem 0 0;
    font-size: 0.9rem;
    color: var(--iws-heading);
}

.chat-create {
    display: grid;
    gap: 0.4rem;
}

/* Too narrow for the list beside the conversation: two steps, list then conversation with Back. */
@container (max-width: 34rem) {
    .chat-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .chat-list {
        border-right: none;
    }

    .chat-panel .chat-side {
        display: none;
    }

    .chat-panel.shows-conversation .chat-list {
        display: none;
    }

    .chat-panel.shows-conversation .chat-side {
        display: grid;
    }

    .chat-back {
        display: inline-grid;
    }
}
