/*
 * Le chat utilise des variables locales afin de suivre automatiquement
 * les thèmes Sysimple appliqués sur le <body> par ThemeManager.
 */
body,
.sys-chat-panel {
    --sys-chat-primary: #1aa3ff;
    --sys-chat-primary-hover: #0094ff;
    --sys-chat-panel-bg: #f2f6fb;
    --sys-chat-surface: #fbfdff;
    --sys-chat-surface-alt: #ffffff;
    --sys-chat-sidebar-bg: #eef4f9;
    --sys-chat-conversation-bg: #f6f9fc;
    --sys-chat-border: rgba(0, 0, 0, .10);
    --sys-chat-text: #223042;
    --sys-chat-muted: #6a7c90;
    --sys-chat-subtle: rgba(34, 48, 66, .06);
    --sys-chat-hover: rgba(26, 163, 255, .08);
    --sys-chat-active: rgba(26, 163, 255, .14);
    --sys-chat-own-bg: #1aa3ff;
    --sys-chat-own-text: #ffffff;
    --sys-chat-other-bg: #fbfdff;
    --sys-chat-header-bg: #fbfdff;
    --sys-chat-header-text: #223042;
    --sys-chat-header-muted: #6a7c90;
    --sys-chat-danger: #d9534f;
    --sys-chat-success: #35a56f;
    --sys-chat-warning: #f0ad4e;
    --sys-chat-type-linked: #2f80ed;
    --sys-chat-type-private: #d98a00;
    --sys-chat-type-direct: #8b5cf6;
    --sys-chat-type-owned: #249663;
    --sys-chat-type-general: #6f7f90;
    --sys-chat-radius: 10px;
    --sys-chat-control-radius: 10px;
    --sys-chat-shadow: -14px 0 34px rgba(20, 38, 52, .20);
}

.sys-chat-header-item > a {
    position: relative;
}

.sys-chat-header-item > a.has-unread {
    background: rgba(26, 163, 255, .14);
}

.sys-chat-count {
    position: absolute;
    top: 6px;
    right: 3px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border: 2px solid rgba(255, 255, 255, .92);
    border-radius: 9px;
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 13px;
    text-align: center;
    box-sizing: border-box;
}


body.skin-sysimple-midnight .sys-chat-header-item > a.has-unread,
body.skin-sysimple-vs .sys-chat-header-item > a.has-unread {
    background: rgba(86, 156, 214, .18);
}

.sys-chat-overlay {
    position: fixed;
    inset: 0;
    z-index: 10040;
    visibility: hidden;
    background: rgba(12, 23, 39, .34);
    opacity: 0;
    transition: opacity .2s ease, visibility .2s ease;
}

.sys-chat-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    width: min(900px, calc(100vw - 28px));
    height: 100vh;
    overflow: hidden;
    border-left: 1px solid var(--sys-chat-border);
    color: var(--sys-chat-text);
    background: var(--sys-chat-panel-bg);
    box-shadow: var(--sys-chat-shadow);
    transform: translateX(104%);
    transition: transform .24s ease;
}

body.sys-chat-open {
    overflow: hidden;
}

body.sys-chat-open .sys-chat-overlay {
    visibility: visible;
    opacity: 1;
}

body.sys-chat-open .sys-chat-panel {
    transform: translateX(0);
}

.sys-chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--sys-chat-border);
    color: var(--sys-chat-header-text);
    background: var(--sys-chat-header-bg);
}

.sys-chat-panel-heading {
    min-width: 0;
}

.sys-chat-panel-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 19px;
    font-weight: 700;
}

.sys-chat-panel-subtitle {
    margin-top: 3px;
    color: var(--sys-chat-header-muted);
    font-size: 12px;
}

.sys-chat-panel-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sys-chat-close,
.sys-chat-icon-button,
.sys-chat-mobile-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
}

.sys-chat-close {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--sys-chat-header-muted);
    font-size: 18px;
}

.sys-chat-close:hover,
.sys-chat-close:focus {
    color: var(--sys-chat-header-text);
    background: var(--sys-chat-hover);
    outline: none;
}

.sys-chat-connection {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--sys-chat-header-muted);
    font-size: 11px;
    white-space: nowrap;
}

.sys-chat-connection::before {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f1c40f;
    content: '';
}

.sys-chat-connection.is-connected::before {
    background: #39d98a;
}

.sys-chat-connection.is-disconnected::before {
    background: #ff6b6b;
}

.sys-chat-inline-status {
    position: absolute;
    z-index: 3;
    top: 78px;
    right: 18px;
    max-width: 420px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #fff;
    background: var(--sys-chat-success);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
    font-size: 12px;
}

.sys-chat-inline-status.is-error {
    background: var(--sys-chat-danger);
}

.sys-chat-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    flex: 1;
    height: calc(100vh - 72px);
    min-height: 0;
    overflow: hidden;
}

.sys-chat-rooms-pane {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid var(--sys-chat-border);
    background: var(--sys-chat-sidebar-bg);
}

.sys-chat-sidebar-view-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 7px;
    border-bottom: 1px solid var(--sys-chat-border);
    background: var(--sys-chat-surface);
}

.sys-chat-sidebar-view-tabs button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 0;
    height: 38px;
    padding: 0 9px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--sys-chat-muted);
    background: transparent;
    font-size: 12px;
    font-weight: 700;
}

.sys-chat-sidebar-view-tabs button:hover,
.sys-chat-sidebar-view-tabs button:focus {
    color: var(--sys-chat-primary);
    background: var(--sys-chat-hover);
    outline: none;
}

.sys-chat-sidebar-view-tabs button.is-active {
    border-color: var(--sys-chat-primary);
    color: var(--sys-chat-primary);
    background: var(--sys-chat-active);
}

.sys-chat-sidebar-view-tabs button small {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    color: #fff;
    background: var(--sys-chat-success);
    font-size: 9px;
    line-height: 18px;
    text-align: center;
}

.sys-chat-sidebar-view-tabs button small[hidden] {
    display: none;
}

.sys-chat-sidebar-view {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.sys-chat-sidebar-view[hidden] {
    display: none;
}

.sys-chat-rooms-header,
.sys-chat-conversation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 10px 13px;
    border-bottom: 1px solid var(--sys-chat-border);
    background: var(--sys-chat-surface);
}

.sys-chat-rooms-header > div {
    display: flex;
    gap: 4px;
}

.sys-chat-room-filter {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    padding: 9px 11px 0;
}

.sys-chat-room-filter-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    height: 36px;
    border: 1px solid var(--sys-chat-border);
    border-radius: 999px;
    color: var(--sys-chat-muted);
    background: var(--sys-chat-surface-alt);
    font-size: 13px;
    font-weight: 600;
}

.sys-chat-room-filter-tab span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.sys-chat-room-filter-tab small {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    color: var(--sys-chat-text);
    background: var(--sys-chat-subtle);
    font-size: 10px;
    line-height: 18px;
    text-align: center;
}

.sys-chat-room-filter-tab em {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border: 2px solid var(--sys-chat-sidebar-bg);
    border-radius: 999px;
    color: #fff;
    background: #e74c3c;
    font-size: 9px;
    font-style: normal;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
}

.sys-chat-room-filter-tab em[hidden] {
    display: none;
}

.sys-chat-room-filter-tab:hover,
.sys-chat-room-filter-tab:focus,
.sys-chat-room-filter-tab.is-active {
    border-color: var(--sys-chat-primary);
    color: var(--sys-chat-primary);
    background: var(--sys-chat-active);
    outline: none;
}

.sys-chat-icon-button,
.sys-chat-mobile-back {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: var(--sys-chat-muted);
}

.sys-chat-icon-button:hover,
.sys-chat-icon-button:focus,
.sys-chat-mobile-back:hover,
.sys-chat-mobile-back:focus {
    color: var(--sys-chat-primary);
    background: var(--sys-chat-hover);
    outline: none;
}

.sys-chat-room-search {
    position: relative;
    padding: 10px 11px 8px;
}

.sys-chat-room-search > i {
    position: absolute;
    top: 21px;
    left: 23px;
    z-index: 1;
    color: var(--sys-chat-muted);
}

.sys-chat-room-search .form-control {
    height: 36px;
    padding-left: 34px;
    border-color: transparent;
    border-radius: var(--sys-chat-control-radius);
    box-shadow: none;
    background: var(--sys-chat-surface-alt);
}

.sys-chat-new-room-wrap {
    margin: 0 11px 9px;
    padding: 10px;
    border: 1px solid var(--sys-chat-border);
    border-radius: var(--sys-chat-radius);
    background: var(--sys-chat-surface-alt);
}

.sys-chat-new-room-private {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    margin: 9px 0 0;
    color: var(--sys-chat-text);
    font-weight: 400;
}

.sys-chat-new-room-private input {
    margin-top: 2px;
}

.sys-chat-new-room-private strong,
.sys-chat-new-room-private small {
    display: block;
}

.sys-chat-new-room-private strong {
    font-size: 12px;
}

.sys-chat-new-room-private small {
    color: var(--sys-chat-muted);
    font-size: 10px;
}

.sys-chat-new-room-actions {
    display: flex;
    gap: 7px;
    margin-top: 8px;
}

.sys-chat-room-list {
    flex: 1;
    min-height: 0;
    max-height: calc(100vh - 72px - 58px - 45px - 54px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 2px 7px 12px;
    scrollbar-color: var(--sys-chat-muted) transparent;
    scrollbar-width: thin;
}

.sys-chat-room-list::-webkit-scrollbar {
    width: 9px;
}

.sys-chat-room-list::-webkit-scrollbar-track {
    background: transparent;
}

.sys-chat-room-list::-webkit-scrollbar-thumb {
    border: 2px solid var(--sys-chat-sidebar-bg);
    border-radius: 999px;
    background: color-mix(in srgb, var(--sys-chat-muted) 65%, transparent);
}

.sys-chat-room-list::-webkit-scrollbar-thumb:hover {
    background: var(--sys-chat-muted);
}

.sys-chat-team-view {
    background: var(--sys-chat-sidebar-bg);
}

.sys-chat-team-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--sys-chat-border);
    background: var(--sys-chat-surface);
}

.sys-chat-team-search {
    position: relative;
    padding: 10px 11px 7px;
}

.sys-chat-team-search > i {
    position: absolute;
    z-index: 1;
    top: 21px;
    left: 23px;
    color: var(--sys-chat-muted);
}

.sys-chat-team-search .form-control {
    height: 36px;
    padding-left: 34px;
    border-color: transparent;
    border-radius: var(--sys-chat-control-radius);
    color: var(--sys-chat-text);
    background: var(--sys-chat-surface-alt);
    box-shadow: none;
}

.sys-chat-team-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 0 11px 8px;
}

.sys-chat-team-filter button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    height: 32px;
    padding: 0 9px;
    border: 1px solid var(--sys-chat-border);
    border-radius: 7px;
    color: var(--sys-chat-muted);
    background: var(--sys-chat-surface-alt);
    font-size: 11px;
    font-weight: 600;
}

.sys-chat-team-filter button:hover,
.sys-chat-team-filter button:focus,
.sys-chat-team-filter button.is-active {
    border-color: var(--sys-chat-primary);
    color: var(--sys-chat-primary);
    background: var(--sys-chat-active);
    outline: none;
}

.sys-chat-team-filter button small {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    color: var(--sys-chat-text);
    background: var(--sys-chat-subtle);
    font-size: 9px;
    line-height: 18px;
    text-align: center;
}

.sys-chat-team-list {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 2px 7px 12px;
    scrollbar-color: var(--sys-chat-muted) transparent;
    scrollbar-width: thin;
}

.sys-chat-team-list::-webkit-scrollbar {
    width: 9px;
}

.sys-chat-team-list::-webkit-scrollbar-track {
    background: transparent;
}

.sys-chat-team-list::-webkit-scrollbar-thumb {
    border: 2px solid var(--sys-chat-sidebar-bg);
    border-radius: 999px;
    background: color-mix(in srgb, var(--sys-chat-muted) 65%, transparent);
}

.sys-chat-team-user {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 8px;
    min-height: 64px;
    margin: 2px 0;
    padding: 7px;
    border-left: 3px solid transparent;
    border-radius: 7px;
    color: var(--sys-chat-text);
}

.sys-chat-team-user:hover,
.sys-chat-team-user:focus-within {
    background: var(--sys-chat-hover);
}

.sys-chat-team-user.is-current {
    border-left-color: var(--sys-chat-primary);
    background: var(--sys-chat-subtle);
}

.sys-chat-team-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #fff;
    background: var(--sys-chat-user-color, var(--sys-chat-primary));
    font-size: 12px;
    font-weight: 800;
}

.sys-chat-team-avatar i {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 11px;
    height: 11px;
    border: 2px solid var(--sys-chat-sidebar-bg);
    border-radius: 50%;
    background: var(--sys-chat-muted);
}

.sys-chat-team-user.is-online .sys-chat-team-avatar i {
    background: var(--sys-chat-success);
}

.sys-chat-team-identity {
    min-width: 0;
}

.sys-chat-team-identity strong,
.sys-chat-team-identity small,
.sys-chat-team-presence {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-chat-team-identity strong {
    color: var(--sys-chat-text);
    font-size: 12px;
}

.sys-chat-team-identity small {
    margin-top: 1px;
    color: var(--sys-chat-muted);
    font-size: 9px;
}

.sys-chat-team-presence {
    margin-top: 2px;
    color: var(--sys-chat-muted);
    font-size: 9px;
}

.sys-chat-team-user.is-online .sys-chat-team-presence {
    color: var(--sys-chat-success);
    font-weight: 700;
}

.sys-chat-team-message {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--sys-chat-border);
    border-radius: 50%;
    color: var(--sys-chat-primary);
    background: var(--sys-chat-surface-alt);
}

.sys-chat-team-message:hover,
.sys-chat-team-message:focus {
    border-color: var(--sys-chat-primary);
    background: var(--sys-chat-active);
    outline: none;
}

.sys-chat-team-message:disabled {
    cursor: default;
    color: var(--sys-chat-muted);
    opacity: .72;
}

.sys-chat-team-message span {
    font-size: 8px;
    font-weight: 700;
}

.sys-chat-team-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 180px;
    padding: 20px;
    color: var(--sys-chat-muted);
    text-align: center;
    font-size: 11px;
}

.sys-chat-team-empty i {
    color: var(--sys-chat-primary);
    font-size: 28px;
}

.sys-chat-room {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    margin: 2px 0;
    padding: 9px 8px;
    border: 0;
    border-radius: var(--sys-chat-radius);
    color: var(--sys-chat-text);
    text-align: left;
    background: transparent;
}

.sys-chat-room:hover,
.sys-chat-room:focus {
    background: var(--sys-chat-hover);
    outline: none;
}

.sys-chat-room.is-active {
    color: var(--sys-chat-text);
    background: var(--sys-chat-active);
}

.sys-chat-room.is-created-by-me {
    border-left: 3px solid var(--sys-chat-type-owned);
    background: var(--sys-chat-hover);
    background: color-mix(in srgb, var(--sys-chat-type-owned) 8%, transparent);
}

.sys-chat-room-avatar {
    --sys-chat-room-type-color: var(--sys-chat-type-general);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--sys-chat-radius);
    color: var(--sys-chat-room-type-color);
    background: color-mix(in srgb, var(--sys-chat-room-type-color) 15%, transparent);
}

.sys-chat-room.is-context .sys-chat-room-avatar {
    --sys-chat-room-type-color: var(--sys-chat-type-linked);
}

.sys-chat-room.is-private .sys-chat-room-avatar {
    --sys-chat-room-type-color: var(--sys-chat-type-private);
}

.sys-chat-room.is-direct .sys-chat-room-avatar {
    --sys-chat-room-type-color: var(--sys-chat-type-direct);
    border-radius: 50%;
}

.sys-chat-room.is-created-by-me .sys-chat-room-avatar {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sys-chat-type-owned) 55%, transparent);
}

.sys-chat-room-text {
    min-width: 0;
    padding: 0 7px;
}

.sys-chat-room-text strong,
.sys-chat-room-text small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-chat-room-text strong {
    font-size: 13px;
}

.sys-chat-room-text small {
    margin-top: 2px;
    color: var(--sys-chat-muted);
    font-size: 10px;
}

.sys-chat-room-owner,
.sys-chat-room-record {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
    color: var(--sys-chat-muted);
    font-size: 10px;
    font-weight: 600;
}

.sys-chat-room-owner {
    color: var(--sys-chat-primary);
}

.sys-chat-room-owner[hidden],
.sys-chat-room-record[hidden] {
    display: none;
}

.sys-chat-room-owner i,
.sys-chat-room-record i,
.sys-chat-conversation-record i {
    color: var(--sys-chat-primary);
}

.sys-chat-conversation-record {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

.sys-chat-archived-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #d39b32;
    font-weight: 700;
}

.sys-chat-room-unread {
    min-width: 21px;
    height: 21px;
    padding: 0 6px;
    border-radius: 11px;
    color: #fff;
    background: #e74c3c;
    font-size: 10px;
    font-weight: 700;
    line-height: 21px;
    text-align: center;
}

.sys-chat-room-empty,
.sys-chat-conversation-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 100%;
    min-height: 150px;
    padding: 24px;
    color: var(--sys-chat-muted);
    text-align: center;
}

.sys-chat-room-empty i,
.sys-chat-conversation-empty i {
    color: #a9b9ca;
    font-size: 30px;
}

.sys-chat-conversation-pane {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 0;
    background: var(--sys-chat-conversation-bg);
}

.sys-chat-conversation-title-wrap {
    flex: 1;
    min-width: 0;
}

.sys-chat-conversation-title-wrap strong,
.sys-chat-conversation-title-wrap small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-chat-conversation-title-wrap small {
    margin-top: 3px;
    color: var(--sys-chat-muted);
}

.sys-chat-direct-presence {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.sys-chat-direct-presence i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sys-chat-muted);
}

.sys-chat-direct-presence.is-online {
    color: var(--sys-chat-success);
}

.sys-chat-direct-presence.is-online i {
    background: var(--sys-chat-success);
}

.sys-chat-mobile-back {
    display: none;
    margin-right: 5px;
}

.sys-chat-messages {
    min-height: 0;
    overflow-y: auto;
    padding: 18px 20px;
    scroll-behavior: smooth;
}

.sys-chat-day-separator {
    width: max-content;
    max-width: 90%;
    margin: 12px auto;
    padding: 4px 10px;
    border: 1px solid var(--sys-chat-border);
    border-radius: var(--sys-chat-radius);
    color: var(--sys-chat-muted);
    background: var(--sys-chat-surface);
    font-size: 10px;
    text-align: center;
}

.sys-chat-message {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    margin: 7px 0;
}

.sys-chat-message.is-own {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.sys-chat-message-avatar {
    display: inline-flex;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-top: 2px;
    border: 1px solid var(--sys-chat-border);
    border-radius: 50%;
    color: #fff;
    background: var(--sys-chat-user-color, var(--sys-chat-primary));
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .35px;
    text-transform: uppercase;
}

.sys-chat-message.is-own .sys-chat-message-avatar {
    border-color: transparent;
    color: var(--sys-chat-own-text);
    background: var(--sys-chat-own-bg);
}

.sys-chat-message-bubble {
    max-width: min(72%, 540px);
    padding: 9px 11px;
    border: 1px solid rgba(34, 58, 89, .08);
    border-radius: var(--sys-chat-radius);
    background: var(--sys-chat-other-bg);
    box-shadow: 0 2px 6px rgba(34, 58, 89, .07);
}

.sys-chat-message.is-own .sys-chat-message-bubble {
    border-color: transparent;
    border-radius: var(--sys-chat-radius);
    color: var(--sys-chat-own-text);
    background: var(--sys-chat-own-bg);
}

.sys-chat-message-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 4px;
    color: var(--sys-chat-muted);
    font-size: 10px;
}

.sys-chat-message.is-own .sys-chat-message-meta {
    color: rgba(255, 255, 255, .78);
}

.sys-chat-message-author {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sys-chat-message-author strong,
.sys-chat-message-author small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-chat-message-author strong {
    color: var(--sys-chat-text);
    font-size: 11px;
    font-weight: 700;
}

.sys-chat-message-author small {
    margin-top: 1px;
    color: var(--sys-chat-muted);
    font-size: 9px;
    font-weight: 400;
}

.sys-chat-message.is-own .sys-chat-message-author strong,
.sys-chat-message.is-own .sys-chat-message-author small {
    color: rgba(255, 255, 255, .82);
}

.sys-chat-message-content {
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.sys-chat-message-attachments {
    display: grid;
    gap: 7px;
    margin-top: 6px;
}

.sys-chat-message-image-frame {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.sys-chat-message-image-button {
    display: block;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.sys-chat-message-image {
    display: block;
    width: auto;
    max-width: min(100%, 280px);
    max-height: 280px;
    border-radius: 8px;
    object-fit: contain;
}

.sys-chat-message-download {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: 6px;
    color: #fff;
    background: rgba(5, 13, 24, .72);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .28);
}

.sys-chat-message-download:hover,
.sys-chat-message-download:focus {
    background: rgba(24, 152, 219, .92);
}

.sys-chat-message-file {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) 22px;
    align-items: center;
    gap: 8px;
    width: min(100%, 320px);
    padding: 8px 10px;
    border: 1px solid var(--sys-chat-border);
    border-radius: 8px;
    color: var(--sys-chat-text);
    background: var(--sys-chat-surface);
    text-align: left;
}

.sys-chat-message-file span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Empêche les textes bleus sur les bulles bleues des thèmes sombres. */
.sys-chat-message.is-own .sys-chat-message-bubble,
.sys-chat-message.is-own .sys-chat-message-content,
.sys-chat-message.is-own .sys-chat-message-meta,
.sys-chat-message.is-own .sys-chat-message-meta time,
.sys-chat-message.is-own .sys-chat-message-author strong,
.sys-chat-message.is-own .sys-chat-message-author small,
.sys-chat-message.is-own .sys-chat-message-reply-button,
.sys-chat-message.is-own .sys-chat-message-bubble a {
    color: var(--sys-chat-own-text) !important;
}

.sys-chat-message.is-own .sys-chat-message-reply {
    border-color: rgba(255, 255, 255, .38);
    color: var(--sys-chat-own-text);
    background: rgba(0, 0, 0, .12);
}

.sys-chat-composer {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
    padding: 12px 14px 22px;
    border-top: 1px solid var(--sys-chat-border);
    background: var(--sys-chat-surface);
}

.sys-chat-composer textarea.form-control {
    min-height: 42px;
    max-height: 120px;
    resize: none;
    border-radius: var(--sys-chat-control-radius);
    box-shadow: none;
}

.sys-chat-composer .btn {
    align-self: end;
    min-width: 96px;
    height: 42px;
    border-radius: var(--sys-chat-radius);
}

.sys-chat-composer .btn-primary {
    border-color: var(--sys-chat-primary) !important;
    color: var(--sys-chat-own-text) !important;
    background: var(--sys-chat-primary) !important;
}

.sys-chat-composer .btn-primary:hover,
.sys-chat-composer .btn-primary:focus {
    border-color: var(--sys-chat-primary-hover) !important;
    color: var(--sys-chat-own-text) !important;
    background: var(--sys-chat-primary-hover) !important;
}

.sys-chat-composer .btn i {
    margin-right: 6px;
}

.sys-chat-composer-hint {
    position: absolute;
    right: 15px;
    bottom: 5px;
    color: var(--sys-chat-muted);
    font-size: 9px;
}

/* Thème Corporate et Light */
body.skin-sysimple-corporate,
body.skin-sysimple-corporate .sys-chat-panel,
body.skin-sysimple-soft,
body.skin-sysimple-soft .sys-chat-panel,
body.sys-theme-form-light,
body.sys-theme-form-light .sys-chat-panel {
    --sys-chat-primary: #1aa3ff;
    --sys-chat-primary-hover: #0094ff;
    --sys-chat-panel-bg: #f2f6fb;
    --sys-chat-surface: #fbfdff;
    --sys-chat-surface-alt: #ffffff;
    --sys-chat-sidebar-bg: #eef4f9;
    --sys-chat-conversation-bg: #f6f9fc;
    --sys-chat-border: rgba(0, 0, 0, .10);
    --sys-chat-text: #223042;
    --sys-chat-muted: #6a7c90;
    --sys-chat-hover: rgba(26, 163, 255, .08);
    --sys-chat-active: rgba(26, 163, 255, .14);
    --sys-chat-own-bg: #1aa3ff;
    --sys-chat-own-text: #ffffff;
    --sys-chat-other-bg: #fbfdff;
    --sys-chat-header-bg: #fbfdff;
    --sys-chat-header-text: #223042;
    --sys-chat-header-muted: #6a7c90;
}

/* Les thèmes Sysimple structurés utilisent des contrôles plus carrés. */
body.skin-sysimple-corporate,
body.skin-sysimple-corporate .sys-chat-panel,
body.skin-sysimple-midnight,
body.skin-sysimple-midnight .sys-chat-panel,
body.skin-sysimple-vs,
body.skin-sysimple-vs .sys-chat-panel {
    --sys-chat-radius: 2px;
    --sys-chat-control-radius: 0;
}

/* Thème Midnight / Dark */
body.skin-sysimple-midnight,
body.skin-sysimple-midnight .sys-chat-panel,
body.sys-theme-form-dark,
body.sys-theme-form-dark .sys-chat-panel,
body.dark-mode,
body.dark-mode .sys-chat-panel {
    --sys-chat-primary: #1aa3ff;
    --sys-chat-primary-hover: #0094ff;
    --sys-chat-panel-bg: #0c1220;
    --sys-chat-surface: #111a2c;
    --sys-chat-surface-alt: #0f1728;
    --sys-chat-sidebar-bg: #0f1728;
    --sys-chat-conversation-bg: #0c1220;
    --sys-chat-border: rgba(255, 255, 255, .10);
    --sys-chat-text: #dbe5f0;
    --sys-chat-muted: rgba(207, 216, 227, .70);
    --sys-chat-hover: rgba(26, 163, 255, .10);
    --sys-chat-active: rgba(26, 163, 255, .16);
    --sys-chat-own-bg: #1aa3ff;
    --sys-chat-own-text: #ffffff;
    --sys-chat-other-bg: #111a2c;
    --sys-chat-header-bg: #0f1728;
    --sys-chat-header-text: #e6eef7;
    --sys-chat-header-muted: rgba(207, 216, 227, .72);
    --sys-chat-shadow: -14px 0 34px rgba(0, 0, 0, .42);
}

/* Thème Visual Studio */
body.skin-sysimple-vs,
body.skin-sysimple-vs .sys-chat-panel,
body.sys-theme-form-vs,
body.sys-theme-form-vs .sys-chat-panel {
    --sys-chat-primary: #569cd6;
    --sys-chat-primary-hover: #4f8cc5;
    --sys-chat-panel-bg: #1e1e1e;
    --sys-chat-surface: #252526;
    --sys-chat-surface-alt: #2d2d30;
    --sys-chat-sidebar-bg: #252526;
    --sys-chat-conversation-bg: #1e1e1e;
    --sys-chat-border: rgba(255, 255, 255, .10);
    --sys-chat-text: #d4d4d4;
    --sys-chat-muted: rgba(212, 212, 212, .70);
    --sys-chat-hover: rgba(86, 156, 214, .10);
    --sys-chat-active: rgba(86, 156, 214, .16);
    --sys-chat-own-bg: #569cd6;
    --sys-chat-own-text: #ffffff;
    --sys-chat-other-bg: #252526;
    --sys-chat-header-bg: #2d2d30;
    --sys-chat-header-text: #ffffff;
    --sys-chat-header-muted: rgba(212, 212, 212, .72);
    --sys-chat-shadow: -14px 0 34px rgba(0, 0, 0, .48);
}

.sys-chat-panel .form-control {
    border-color: var(--sys-chat-border) !important;
    color: var(--sys-chat-text) !important;
    background: var(--sys-chat-surface-alt) !important;
}

.sys-chat-panel .form-control::placeholder {
    color: var(--sys-chat-muted) !important;
}

.sys-chat-panel .form-control:focus {
    border-color: var(--sys-chat-primary) !important;
    box-shadow: 0 0 0 3px rgba(26, 163, 255, .20) !important;
}

body.skin-sysimple-vs .sys-chat-panel .form-control:focus,
body.sys-theme-form-vs .sys-chat-panel .form-control:focus {
    box-shadow: 0 0 0 3px rgba(86, 156, 214, .22) !important;
}


/* Dialogue Sysimple d'archivage */
.sys-chat-dialog-backdrop {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(5, 13, 24, .58);
    backdrop-filter: blur(2px);
}

.sys-chat-dialog-backdrop[hidden] {
    display: none;
}

.sys-chat-dialog {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 14px;
    width: min(430px, 100%);
    padding: 20px;
    border: 1px solid var(--sys-chat-border);
    border-radius: var(--sys-chat-radius);
    color: var(--sys-chat-text);
    background: var(--sys-chat-surface-alt);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .38);
}

.sys-chat-dialog-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: var(--sys-chat-danger);
    background: rgba(217, 83, 79, .14);
    font-size: 20px;
}

.sys-chat-dialog-content strong {
    display: block;
    margin: 2px 0 7px;
    color: var(--sys-chat-text);
    font-size: 16px;
}

.sys-chat-dialog-content p {
    margin: 0;
    color: var(--sys-chat-muted);
    font-size: 12px;
    line-height: 1.5;
}

.sys-chat-dialog-actions {
    display: flex;
    grid-column: 1 / -1;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.sys-chat-dialog-actions .btn {
    min-width: 106px;
    border-radius: var(--sys-chat-control-radius);
}

.sys-chat-dialog-actions .btn-default {
    border-color: var(--sys-chat-border) !important;
    color: var(--sys-chat-text) !important;
    background: var(--sys-chat-surface) !important;
}

.sys-chat-camera-backdrop {
    z-index: 24;
}

.sys-chat-camera-dialog {
    display: grid;
    gap: 12px;
    width: min(560px, 100%);
    padding: 14px;
    border: 1px solid var(--sys-chat-border);
    border-radius: var(--sys-chat-radius);
    color: var(--sys-chat-text);
    background: var(--sys-chat-surface-alt);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .38);
}

.sys-chat-camera-preview {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    background: #050d18;
    aspect-ratio: 4 / 3;
}

.sys-chat-camera-preview video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sys-chat-camera-preview small {
    position: absolute;
    inset: auto 12px 12px;
    color: rgba(255, 255, 255, .86);
    font-size: 12px;
    text-align: center;
}

.sys-chat-camera-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.sys-chat-image-preview-backdrop {
    z-index: 26;
}

.sys-chat-image-preview-dialog {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    width: min(920px, 96%);
    height: min(760px, 92%);
    padding: 12px;
    border: 1px solid var(--sys-chat-border);
    border-radius: var(--sys-chat-radius);
    color: var(--sys-chat-text);
    background: var(--sys-chat-surface-alt);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .44);
}

.sys-chat-image-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.sys-chat-image-preview-header strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-chat-image-preview-header > div {
    display: flex;
    gap: 6px;
}

.sys-chat-image-preview-body {
    display: grid;
    place-items: center;
    min-height: 0;
    overflow: auto;
    border-radius: 8px;
    background: #050d18;
}

.sys-chat-image-preview-body img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sys-chat-admin-view {
    display: grid;
    grid-template-rows: auto auto minmax(116px, 1fr) minmax(150px, 1fr);
    gap: 10px;
    min-height: 0;
}

.sys-chat-admin-view[hidden] {
    display: none !important;
}

.sys-chat-admin-room-list,
.sys-chat-admin-message-pane {
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--sys-chat-border);
    border-radius: var(--sys-chat-control-radius);
    background: rgba(8, 16, 31, .28);
}

.sys-chat-admin-room {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--sys-chat-border);
    color: var(--sys-chat-text);
    text-align: left;
    background: transparent;
}

.sys-chat-admin-room:hover,
.sys-chat-admin-room:focus,
.sys-chat-admin-room.is-active {
    background: rgba(33, 150, 243, .14);
}

.sys-chat-admin-room strong,
.sys-chat-admin-room span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-chat-admin-room span {
    grid-column: 1 / -1;
    color: var(--sys-chat-muted);
    font-size: 12px;
}

.sys-chat-admin-room em {
    align-self: start;
    padding: 2px 6px;
    border-radius: 999px;
    font-style: normal;
    font-size: 11px;
    line-height: 1.3;
}

.sys-chat-admin-room em.is-active {
    color: #8ff0b8;
    background: rgba(0, 176, 91, .18);
}

.sys-chat-admin-room em.is-archived {
    color: #ffc46b;
    background: rgba(255, 152, 0, .18);
}

.sys-chat-admin-empty {
    padding: 14px;
    color: var(--sys-chat-muted);
    text-align: center;
}

.sys-chat-admin-actions {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid var(--sys-chat-border);
}

.sys-chat-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid var(--sys-chat-border);
    border-radius: var(--sys-chat-control-radius);
    color: var(--sys-chat-text);
    background: rgba(255, 255, 255, .04);
}

.sys-chat-action-btn:hover,
.sys-chat-action-btn:focus {
    border-color: var(--sys-chat-accent);
}

.sys-chat-action-btn.is-danger {
    color: #ffd6d6;
    border-color: rgba(255, 89, 89, .5);
    background: rgba(255, 89, 89, .12);
}

.sys-chat-admin-message-list {
    display: grid;
    gap: 8px;
    padding: 10px;
}

.sys-chat-admin-message {
    display: grid;
    gap: 4px;
    padding: 8px 10px;
    border: 1px solid var(--sys-chat-border);
    border-radius: var(--sys-chat-control-radius);
    background: rgba(255, 255, 255, .035);
}

.sys-chat-admin-message header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.sys-chat-admin-message strong,
.sys-chat-admin-message p {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sys-chat-admin-message time {
    flex: 0 0 auto;
    color: var(--sys-chat-muted);
    font-size: 12px;
}

.sys-chat-admin-message p {
    margin: 0;
    color: var(--sys-chat-text);
    font-size: 13px;
    line-height: 1.45;
}

.sys-chat-dialog-actions .btn-danger {
    border-color: var(--sys-chat-danger) !important;
    color: #fff !important;
    background: var(--sys-chat-danger) !important;
}

.sys-chat-dialog-actions .btn-danger:hover,
.sys-chat-dialog-actions .btn-danger:focus {
    filter: brightness(.92);
}

@media (max-width: 767px) {
    .sys-chat-panel {
        width: 100vw;
    }

    .sys-chat-panel-subtitle,
    .sys-chat-connection {
        display: none;
    }

    .sys-chat-layout {
        position: relative;
        display: block;
        overflow: hidden;
    }

    .sys-chat-rooms-pane,
    .sys-chat-conversation-pane {
        position: absolute;
        inset: 0;
        width: 100%;
        transition: transform .2s ease;
    }

    .sys-chat-conversation-pane {
        transform: translateX(100%);
    }

    .sys-chat-panel.is-conversation-active .sys-chat-rooms-pane {
        transform: translateX(-100%);
    }

    .sys-chat-panel.is-conversation-active .sys-chat-conversation-pane {
        transform: translateX(0);
    }

    .sys-chat-mobile-back {
        display: inline-flex;
    }

    .sys-chat-message-bubble {
        max-width: 86%;
    }

    .sys-chat-composer {
        padding-bottom: max(22px, env(safe-area-inset-bottom));
    }

    .sys-chat-composer-hint {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sys-chat-panel,
    .sys-chat-overlay,
    .sys-chat-rooms-pane,
    .sys-chat-conversation-pane {
        transition: none;
    }
}

/* Harmonisation finale avec les thèmes Sysimple */
.sys-chat-panel-title .fa {
    color: var(--sys-chat-primary);
}

.sys-chat-room,
.sys-chat-new-room-wrap,
.sys-chat-message-bubble,
.sys-chat-day-separator {
    border-color: var(--sys-chat-border);
}

.sys-chat-room:hover,
.sys-chat-room:focus {
    background: var(--sys-chat-hover);
}

.sys-chat-room.is-active {
    background: var(--sys-chat-active);
}

/* Chat contextuel Sysimple v2 */
.sys-chat-conversation-actions,
.sys-chat-message-meta-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sys-chat-context-room.is-loading .fa {
    animation: fa-spin 1s infinite linear;
}

.sys-chat-room.is-context .sys-chat-room-avatar {
    color: var(--sys-chat-primary);
}

.sys-chat-room.is-private .sys-chat-room-avatar::after {
    content: '';
}

.sys-chat-reply-composer {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid var(--sys-chat-border);
    border-left: 3px solid var(--sys-chat-primary);
    border-radius: 8px;
    background: var(--sys-chat-hover);
}

.sys-chat-reply-composer[hidden] {
    display: none !important;
}

.sys-chat-reply-composer > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.sys-chat-reply-composer strong,
.sys-chat-reply-composer small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-chat-reply-composer strong {
    color: var(--sys-chat-primary);
    font-size: 12px;
}

.sys-chat-reply-composer small {
    color: var(--sys-chat-muted);
}

.sys-chat-message-reply {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 7px;
    padding: 6px 8px;
    border-left: 3px solid var(--sys-chat-primary);
    border-radius: 5px;
    background: color-mix(in srgb, var(--sys-chat-hover) 82%, transparent);
}

.sys-chat-message-reply strong {
    color: var(--sys-chat-primary);
    font-size: 11px;
}

.sys-chat-message-reply span {
    overflow: hidden;
    color: var(--sys-chat-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-chat-message-reply-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--sys-chat-muted);
    background: transparent;
    opacity: 0;
    transition: opacity .15s ease, background .15s ease, color .15s ease;
}

.sys-chat-message:hover .sys-chat-message-reply-button,
.sys-chat-message-reply-button:focus {
    opacity: 1;
}

.sys-chat-message-reply-button:hover,
.sys-chat-message-reply-button:focus {
    color: var(--sys-chat-primary);
    background: var(--sys-chat-hover);
}

.sys-chat-message.is-system {
    justify-content: center;
    margin: 10px 0;
}

.sys-chat-message.is-system .sys-chat-message-bubble {
    max-width: 82%;
    border-style: dashed;
    border-color: var(--sys-chat-border);
    color: var(--sys-chat-muted);
    background: var(--sys-chat-hover);
    box-shadow: none;
}

.sys-chat-message.is-system .sys-chat-message-meta {
    justify-content: center;
}

.sys-chat-message.is-system .sys-chat-message-content {
    text-align: center;
    font-size: 12px;
}

@supports not (background: color-mix(in srgb, white 50%, black)) {
    .sys-chat-message-reply {
        background: var(--sys-chat-hover);
    }
}

/* ================================================================
   Chat v2.6 — participants et sélecteur emoji
   ================================================================ */

.sys-chat-action-count {
    position: absolute;
    top: 1px;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border: 2px solid var(--sys-chat-surface);
    border-radius: 9px;
    color: #fff;
    background: var(--sys-chat-primary);
    font-size: 9px;
    font-weight: 700;
    line-height: 12px;
    text-align: center;
}

.sys-chat-participants-room {
    position: relative;
}

.sys-chat-message-entry {
    position: relative;
    min-width: 0;
}

.sys-chat-file-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    pointer-events: none !important;
    opacity: 0 !important;
}

.sys-chat-message-entry textarea.form-control {
    width: 100%;
    padding-left: 116px;
    padding-right: 12px;
    font-family: inherit, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.sys-chat-mention-list {
    position: absolute;
    z-index: 4;
    right: 0;
    bottom: calc(100% + 7px);
    left: 0;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--sys-chat-border);
    border-radius: var(--sys-chat-radius);
    box-shadow: 0 14px 32px rgba(0, 0, 0, .24);
    background: var(--sys-chat-surface-alt);
    scrollbar-color: var(--sys-chat-muted) transparent;
    scrollbar-width: thin;
}

.sys-chat-mention-list.sys-chat-mention-list-floating {
    position: fixed;
    z-index: 2147483000;
    right: auto;
    bottom: auto;
    left: auto;
    width: min(380px, calc(100vw - 16px));
    max-height: 280px;
}

/* La liste @ de Summernote reprend exactement le composant du chat. */
.note-hint-popover.sys-chat-mention-popover {
    z-index: 2147483000 !important;
    width: min(380px, calc(100vw - 16px));
    max-width: calc(100vw - 16px);
    padding: 0;
    border: 1px solid var(--sys-chat-border) !important;
    border-radius: var(--sys-chat-radius) !important;
    color: var(--sys-chat-text) !important;
    background: var(--sys-chat-surface-alt) !important;
    box-shadow: 0 14px 32px rgba(0, 0, 0, .24) !important;
}

.note-hint-popover.sys-chat-mention-popover .popover-content,
.note-hint-popover.sys-chat-mention-popover .note-hint-group {
    padding: 3px !important;
    background: transparent !important;
}

.note-hint-popover.sys-chat-mention-popover .note-hint-item {
    display: block;
    width: 100%;
    padding: 0 !important;
    border: 0 !important;
    color: inherit !important;
    background: transparent !important;
    text-decoration: none !important;
}

.note-hint-popover.sys-chat-mention-popover .sys-chat-mention-option-summernote {
    box-sizing: border-box;
    cursor: pointer;
}

.note-hint-popover.sys-chat-mention-popover .note-hint-item:hover .sys-chat-mention-option-summernote,
.note-hint-popover.sys-chat-mention-popover .note-hint-item.active .sys-chat-mention-option-summernote {
    border-color: var(--sys-chat-primary);
    background: var(--sys-chat-active);
}

.sys-chat-mention-option {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: calc(var(--sys-chat-radius) - 2px);
    color: var(--sys-chat-text);
    background: transparent;
    text-align: left;
}

.sys-chat-mention-option:hover,
.sys-chat-mention-option:focus,
.sys-chat-mention-option.is-selected {
    border-color: var(--sys-chat-primary);
    outline: none;
    background: var(--sys-chat-active);
}

.sys-chat-mention-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    margin-right: 8px;
    border: 1px solid var(--sys-chat-user-color, var(--sys-chat-primary));
    border-radius: 50%;
    color: #fff;
    background: var(--sys-chat-user-color, var(--sys-chat-primary));
    font-size: 11px;
    font-weight: 700;
}

.sys-chat-mention-identity {
    min-width: 0;
    flex: 1;
}

.sys-chat-mention-identity strong,
.sys-chat-mention-identity small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-chat-mention-identity strong {
    color: var(--sys-chat-text);
    font-size: 13px;
    font-weight: 700;
}

.sys-chat-mention-identity small {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--sys-chat-muted);
    font-size: 10px;
}

.sys-chat-mention-code {
    color: var(--sys-chat-muted);
    font-size: 10px;
    font-weight: 600;
}

.sys-chat-mention-status {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px;
    color: var(--sys-chat-muted);
    font-size: 12px;
}

.sys-chat-emoji-button {
    position: absolute;
    z-index: 2;
    bottom: 5px;
    left: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: var(--sys-chat-control-radius);
    color: var(--sys-chat-muted);
    background: transparent;
    font-size: 17px;
}

.sys-chat-attachment-button {
    left: 5px;
}

.sys-chat-camera-button {
    left: 42px;
}

.sys-chat-emoji-button:not(.sys-chat-attachment-button):not(.sys-chat-camera-button) {
    left: 79px;
}

.sys-chat-emoji-button:hover,
.sys-chat-emoji-button:focus,
.sys-chat-emoji-button[aria-expanded="true"] {
    color: var(--sys-chat-primary);
    background: var(--sys-chat-hover);
    outline: none;
}

.sys-chat-emoji-button:disabled {
    cursor: default;
    opacity: .45;
}

.sys-chat-attachment-preview {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 0;
}

.sys-chat-attachment-preview[hidden] {
    display: none !important;
}

.sys-chat-attachment-preview-item {
    position: relative;
    width: 74px;
    height: 74px;
    border: 1px solid var(--sys-chat-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--sys-chat-surface-alt);
}

.sys-chat-attachment-preview-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sys-chat-attachment-preview-file {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    width: 100%;
    height: 100%;
    padding: 8px 28px 8px 8px;
    color: var(--sys-chat-text);
}

.sys-chat-attachment-preview-file span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-chat-attachment-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(0, 0, 0, .62);
}

.sys-chat-emoji-picker {
    position: absolute;
    z-index: 30;
    right: auto;
    bottom: calc(100% + 8px);
    left: 0;
    display: flex;
    flex-direction: column;
    width: min(390px, calc(100vw - 54px));
    max-height: 430px;
    overflow: hidden;
    border: 1px solid var(--sys-chat-border);
    border-radius: var(--sys-chat-radius);
    color: var(--sys-chat-text);
    background: var(--sys-chat-surface-alt);
    box-shadow: 0 18px 46px rgba(0, 0, 0, .28);
}

.sys-chat-emoji-picker[hidden] {
    display: none;
}

.sys-chat-emoji-picker-header {
    position: relative;
    padding: 10px;
    border-bottom: 1px solid var(--sys-chat-border);
    background: var(--sys-chat-surface);
}

.sys-chat-emoji-picker-header > i {
    position: absolute;
    top: 21px;
    left: 22px;
    z-index: 1;
    color: var(--sys-chat-muted);
}

.sys-chat-emoji-picker-header .form-control {
    height: 36px;
    padding-left: 34px;
    border-radius: var(--sys-chat-control-radius);
}

.sys-chat-emoji-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--sys-chat-border);
    background: var(--sys-chat-surface);
}

.sys-chat-emoji-categories,
.sys-chat-emoji-tones {
    display: flex;
    align-items: center;
    gap: 2px;
}

.sys-chat-emoji-categories {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

.sys-chat-emoji-category,
.sys-chat-emoji-tone,
.sys-chat-emoji-item {
    border: 0;
    color: var(--sys-chat-text);
    background: transparent;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.sys-chat-emoji-category {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    font-size: 16px;
}

.sys-chat-emoji-category:hover,
.sys-chat-emoji-category:focus,
.sys-chat-emoji-category.is-active {
    background: var(--sys-chat-active);
    outline: none;
}

.sys-chat-emoji-tones {
    flex: 0 0 auto;
    padding-left: 6px;
    border-left: 1px solid var(--sys-chat-border);
}

.sys-chat-emoji-tone {
    display: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 14px;
}

.sys-chat-emoji-tone:first-child,
.sys-chat-emoji-tone.is-active,
.sys-chat-emoji-tones:hover .sys-chat-emoji-tone,
.sys-chat-emoji-tones:focus-within .sys-chat-emoji-tone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sys-chat-emoji-tone:hover,
.sys-chat-emoji-tone:focus,
.sys-chat-emoji-tone.is-active {
    background: var(--sys-chat-active);
    outline: none;
}

.sys-chat-emoji-grid {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 2px;
    min-height: 160px;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    overscroll-behavior: contain;
}

.sys-chat-emoji-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: 36px;
    border-radius: 7px;
    font-size: 22px;
    line-height: 1;
}

.sys-chat-emoji-item:hover,
.sys-chat-emoji-item:focus {
    background: var(--sys-chat-active);
    outline: none;
    transform: scale(1.08);
}

.sys-chat-emoji-empty {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    color: var(--sys-chat-muted);
    font-size: 12px;
    text-align: center;
}

.sys-chat-message-content {
    font-family: inherit, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

/* Dialogue de gestion des participants */
.sys-chat-participants-backdrop {
    z-index: 40;
    padding: 18px;
}

.sys-chat-participants-dialog {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(760px, 100%);
    max-height: min(760px, calc(100vh - 36px));
    overflow: hidden;
    border: 1px solid var(--sys-chat-border);
    border-radius: var(--sys-chat-radius);
    color: var(--sys-chat-text);
    background: var(--sys-chat-surface-alt);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .42);
}

.sys-chat-participants-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px 17px;
    border-bottom: 1px solid var(--sys-chat-border);
    background: var(--sys-chat-surface);
}

.sys-chat-participants-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
}

.sys-chat-participants-heading > div {
    min-width: 0;
}

.sys-chat-participants-heading strong,
.sys-chat-participants-heading small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-chat-participants-heading strong {
    color: var(--sys-chat-text);
    font-size: 16px;
}

.sys-chat-participants-heading small {
    margin-top: 2px;
    color: var(--sys-chat-muted);
    font-size: 11px;
}

.sys-chat-participants-icon {
    display: inline-flex;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: var(--sys-chat-primary);
    background: var(--sys-chat-active);
    font-size: 17px;
}

.sys-chat-participants-body {
    min-height: 0;
    overflow: auto;
    padding: 16px 17px 18px;
}

.sys-chat-participants-intro {
    margin: 0 0 13px;
    color: var(--sys-chat-muted);
    font-size: 12px;
    line-height: 1.45;
}

.sys-chat-participants-privacy {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 13px;
    padding: 11px 12px;
    border: 1px solid var(--sys-chat-border);
    border-radius: var(--sys-chat-radius);
    background: var(--sys-chat-surface);
    cursor: pointer;
}

.sys-chat-participants-privacy > span:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.sys-chat-participants-privacy strong {
    color: var(--sys-chat-text);
    font-size: 12px;
}

.sys-chat-participants-privacy small {
    margin-top: 2px;
    color: var(--sys-chat-muted);
    font-size: 10px;
}

.sys-chat-switch {
    position: relative;
    display: inline-flex;
    flex: 0 0 40px;
    width: 40px;
    height: 22px;
}

.sys-chat-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.sys-chat-switch > span {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: var(--sys-chat-border);
    transition: background .15s ease;
}

.sys-chat-switch > span::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .24);
    content: '';
    transition: transform .15s ease;
}

.sys-chat-switch input:checked + span {
    background: var(--sys-chat-primary);
}

.sys-chat-switch input:checked + span::after {
    transform: translateX(18px);
}

.sys-chat-switch input:focus + span {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--sys-chat-primary) 24%, transparent);
}

.sys-chat-switch input:disabled + span {
    opacity: .55;
}

.sys-chat-participants-readonly,
.sys-chat-participants-status {
    margin-bottom: 12px;
    padding: 9px 11px;
    border-radius: var(--sys-chat-radius);
    color: var(--sys-chat-muted);
    background: var(--sys-chat-hover);
    font-size: 11px;
    line-height: 1.4;
}

.sys-chat-participants-status {
    color: var(--sys-chat-success);
    background: color-mix(in srgb, var(--sys-chat-success) 12%, transparent);
}

.sys-chat-participants-status.is-error {
    color: var(--sys-chat-danger);
    background: color-mix(in srgb, var(--sys-chat-danger) 12%, transparent);
}

.sys-chat-participants-search {
    position: relative;
    margin-bottom: 14px;
}

.sys-chat-participants-search > i {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1;
    color: var(--sys-chat-muted);
}

.sys-chat-participants-search .form-control {
    height: 38px;
    padding-left: 34px;
}

.sys-chat-participants-sections {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(220px, .75fr);
    gap: 14px;
}

.sys-chat-participants-sections section {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--sys-chat-border);
    border-radius: var(--sys-chat-radius);
    background: var(--sys-chat-surface);
}

.sys-chat-participants-sections h4 {
    margin: 0;
    padding: 10px 12px;
    border-bottom: 1px solid var(--sys-chat-border);
    color: var(--sys-chat-text);
    background: var(--sys-chat-surface-alt);
    font-size: 12px;
    font-weight: 700;
}

.sys-chat-participants-sections h4 i {
    margin-right: 6px;
    color: var(--sys-chat-primary);
}

.sys-chat-participants-list {
    max-height: 360px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 6px;
}

.sys-chat-participant-user {
    display: grid;
    grid-template-columns: 24px 36px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 8px;
    min-height: 58px;
    padding: 7px;
    overflow: hidden;
    border-radius: calc(var(--sys-chat-radius) - 2px);
}

.sys-chat-participant-user:hover,
.sys-chat-participant-user.is-selected {
    background: var(--sys-chat-hover);
}

.sys-chat-participant-user.is-admin {
    box-shadow: inset 3px 0 0 var(--sys-chat-warning);
}

.sys-chat-participant-check {
    position: relative;
    display: inline-flex;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.sys-chat-participant-check input {
    position: absolute;
    opacity: 0;
}

.sys-chat-participant-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid var(--sys-chat-border);
    border-radius: 4px;
    background: var(--sys-chat-surface-alt);
}

.sys-chat-participant-check input:checked + .sys-chat-participant-checkbox {
    border-color: var(--sys-chat-primary);
    color: #fff;
    background: var(--sys-chat-primary);
}

.sys-chat-participant-check input:checked + .sys-chat-participant-checkbox::after {
    font-family: FontAwesome;
    font-size: 11px;
    content: '\f00c';
}

.sys-chat-participant-check input:disabled + .sys-chat-participant-checkbox {
    cursor: default;
    opacity: .58;
}

.sys-chat-participant-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--sys-chat-border);
    border-radius: 50%;
    color: #fff;
    background: var(--sys-chat-user-color, var(--sys-chat-primary));
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.sys-chat-participant-identity {
    min-width: 0;
    overflow: hidden;
}

.sys-chat-participant-identity strong,
.sys-chat-participant-identity small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-chat-participant-identity strong {
    color: var(--sys-chat-text);
    font-size: 12px;
}

.sys-chat-participant-identity small {
    margin-top: 2px;
    color: var(--sys-chat-muted);
    font-size: 9px;
}

.sys-chat-participant-badges {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
    margin-top: 4px;
    overflow: hidden;
}

.sys-chat-participant-badge {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    padding: 2px 5px;
    overflow: hidden;
    border-radius: 8px;
    color: var(--sys-chat-primary);
    background: var(--sys-chat-active);
    font-size: 8px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-chat-participant-badge.is-role {
    display: block;
    max-width: 100%;
}

.sys-chat-participant-admin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--sys-chat-muted);
    background: transparent;
}

.sys-chat-participant-admin:hover,
.sys-chat-participant-admin:focus,
.sys-chat-participant-admin.is-active {
    color: var(--sys-chat-warning);
    background: color-mix(in srgb, var(--sys-chat-warning) 14%, transparent);
    outline: none;
}

.sys-chat-participant-admin:disabled {
    opacity: .45;
}

.sys-chat-participant-loading,
.sys-chat-participant-empty {
    display: flex;
    min-height: 180px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    color: var(--sys-chat-muted);
    font-size: 11px;
    text-align: center;
}

.sys-chat-participant-groups {
    min-height: 120px;
    max-height: 260px;
    overflow-y: auto;
    padding: 10px;
}

.sys-chat-participant-groups-empty {
    padding: 18px 8px;
    color: var(--sys-chat-muted);
    font-size: 10px;
    text-align: center;
}

.sys-chat-participant-group-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 5px 5px 0;
    padding: 5px 7px;
    border: 1px solid var(--sys-chat-border);
    border-radius: 14px;
    color: var(--sys-chat-text);
    background: var(--sys-chat-surface-alt);
    font-size: 10px;
    font-weight: 600;
}

.sys-chat-participant-group-chip button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--sys-chat-muted);
    background: transparent;
}

.sys-chat-participant-group-chip button:hover,
.sys-chat-participant-group-chip button:focus {
    color: #fff;
    background: var(--sys-chat-danger);
    outline: none;
}

.sys-chat-participant-group-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--sys-chat-border);
}

.sys-chat-participant-group-option {
    padding: 4px 7px;
    border: 1px dashed var(--sys-chat-border);
    border-radius: 12px;
    color: var(--sys-chat-primary);
    background: transparent;
    font-size: 9px;
}

.sys-chat-participant-group-option:hover,
.sys-chat-participant-group-option:focus {
    border-style: solid;
    background: var(--sys-chat-hover);
    outline: none;
}

.sys-chat-participant-group-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    padding: 10px;
    border-top: 1px solid var(--sys-chat-border);
    background: var(--sys-chat-surface-alt);
}

.sys-chat-participant-group-add .form-control,
.sys-chat-participant-group-add .btn {
    height: 34px;
    border-radius: var(--sys-chat-control-radius);
    font-size: 10px;
}

.sys-chat-participant-group-add .btn-default {
    border-color: var(--sys-chat-border) !important;
    color: var(--sys-chat-text) !important;
    background: var(--sys-chat-surface) !important;
}

.sys-chat-participants-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 17px;
    border-top: 1px solid var(--sys-chat-border);
    background: var(--sys-chat-surface);
}

.sys-chat-participants-actions .btn {
    min-width: 105px;
    border-radius: var(--sys-chat-control-radius);
}

.sys-chat-participants-actions .btn-default {
    border-color: var(--sys-chat-border) !important;
    color: var(--sys-chat-text) !important;
    background: var(--sys-chat-surface-alt) !important;
}

.sys-chat-participants-actions .btn-primary {
    border-color: var(--sys-chat-primary) !important;
    color: #fff !important;
    background: var(--sys-chat-primary) !important;
}

@media (max-width: 767px) {
    .sys-chat-emoji-picker {
        position: fixed;
        right: 10px;
        bottom: max(74px, env(safe-area-inset-bottom));
        left: 10px;
        width: auto;
        max-height: 52vh;
    }

    .sys-chat-emoji-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }

    .sys-chat-participants-backdrop {
        padding: 0;
    }

    .sys-chat-participants-dialog {
        width: 100%;
        height: 100%;
        max-height: none;
        border: 0;
        border-radius: 0;
    }

    .sys-chat-participants-sections {
        grid-template-columns: 1fr;
    }

    .sys-chat-participants-list {
        max-height: 42vh;
    }

    .sys-chat-participant-user {
        grid-template-columns: 24px 34px minmax(0, 1fr) 30px;
    }

    .sys-chat-participant-badges {
        display: none;
    }

    .sys-chat-participant-group-add {
        grid-template-columns: 1fr;
    }
}

/* Rôles Sysimple autorisés dans un salon privé. */
.sys-chat-participant-role-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 48px;
    margin: 0;
    padding: 9px 10px;
    border: 1px solid var(--sys-chat-border);
    border-radius: var(--sys-chat-control-radius);
    background: var(--sys-chat-surface-alt);
    color: var(--sys-chat-text);
    cursor: pointer;
}

.sys-chat-participant-role-row + .sys-chat-participant-role-row {
    margin-top: 7px;
}

.sys-chat-participant-role-row:hover {
    border-color: var(--sys-chat-primary);
    background: var(--sys-chat-hover);
}

.sys-chat-participant-role-row:has(input:checked) {
    border-color: var(--sys-chat-primary);
    background: var(--sys-chat-active);
}

.sys-chat-participant-role-identity {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sys-chat-participant-role-identity strong {
    overflow: hidden;
    color: var(--sys-chat-text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-chat-participant-role-identity small {
    color: var(--sys-chat-muted);
}

.sys-mention-list {
    position: fixed;
    z-index: 2147483000;
    min-width: 260px;
    max-width: min(380px, calc(100vw - 24px));
    max-height: 280px;
    overflow: auto;
    padding: 6px;
    border: 1px solid var(--sys-chat-border, rgba(148, 163, 184, 0.28));
    border-radius: var(--sys-chat-radius, 10px);
    background: var(--sys-chat-surface-alt, #1f2933);
    box-shadow: 0 14px 32px rgba(0, 0, 0, .24);
    scrollbar-color: var(--sys-chat-muted, #94a3b8) transparent;
    scrollbar-width: thin;
}

.sys-mention-option {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: calc(var(--sys-chat-radius, 10px) - 2px);
    color: var(--sys-chat-text, #e5e7eb);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.sys-mention-option:hover,
.sys-mention-option.is-selected {
    border-color: var(--sys-chat-primary, #3b82f6);
    background: var(--sys-chat-active, rgba(59, 130, 246, 0.18));
}

.sys-mention-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    margin-right: 8px;
    border: 1px solid var(--sys-chat-primary, #3b82f6);
    border-radius: 50%;
    color: #fff;
    background: var(--sys-chat-primary, #3b82f6);
    font-size: 11px;
    font-weight: 700;
}

.sys-mention-identity {
    min-width: 0;
    flex: 1;
}

.sys-mention-identity strong,
.sys-mention-identity small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sys-mention-identity small,
.sys-mention-status {
    color: var(--sys-chat-muted, #94a3b8);
}

.sys-mention-identity strong {
    color: var(--sys-chat-text, #e5e7eb);
    font-size: 13px;
    font-weight: 700;
}

.sys-mention-identity small {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 10px;
}

.sys-mention-code {
    color: var(--sys-chat-muted, #94a3b8);
    font-size: 10px;
    font-weight: 600;
}

.sys-mention-status {
    padding: 10px 12px;
}
/* Compact chat workspace, isolated from host-page form and button styles. */
body .sys-chat-panel { width:min(1080px,100vw); height:100dvh; --sys-chat-radius:5px; --sys-chat-control-radius:5px; --sys-chat-primary:#3c8dbc; --sys-chat-primary-hover:#30749b; }
body .sys-chat-panel .sys-chat-panel-header { flex:0 0 auto; min-height:72px; padding:16px 20px; }
body .sys-chat-panel .sys-chat-layout { height:auto; grid-template-columns:290px minmax(0,1fr); }
body .sys-chat-panel .sys-chat-sidebar-view-tabs { grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; padding:8px; }
body .sys-chat-panel .sys-chat-sidebar-view-tabs button { min-width:0; padding:8px 5px; gap:5px; font-size:12px; min-height:36px; }
body .sys-chat-panel .sys-chat-sidebar-view-tabs button.is-active { background:var(--sys-chat-active)!important; color:var(--sys-chat-text)!important; border-bottom:2px solid var(--sys-chat-primary)!important; }
body .sys-chat-panel .sys-chat-rooms-header { padding:12px; min-height:56px; }
body .sys-chat-panel .sys-chat-room-filter { gap:5px; padding:8px 12px; }
body .sys-chat-panel .sys-chat-room-search { padding:4px 12px 12px; position:relative; }
body .sys-chat-panel .sys-chat-room-search > i { top:15px; left:24px; pointer-events:none; }
body .sys-chat-panel .sys-chat-room-search input.form-control { width:100%!important; box-sizing:border-box; padding:8px 10px 8px 34px!important; font:13px inherit; }
body .sys-chat-panel .sys-chat-room-list { padding:0 8px 12px; }
body .sys-chat-panel .sys-chat-room { width:100%; min-width:0; padding:11px 10px; margin:0 0 5px; border:1px solid transparent!important; border-radius:5px; background:transparent!important; text-align:left; }
body .sys-chat-panel .sys-chat-room:hover { background:var(--sys-chat-hover)!important; }
body .sys-chat-panel .sys-chat-room.is-active { background:var(--sys-chat-active)!important; border-left:3px solid var(--sys-chat-primary)!important; }
body .sys-chat-panel .sys-chat-room-text strong { font-size:13px; line-height:1.4; font-weight:600; }
body .sys-chat-panel .sys-chat-room-text small { font-size:11px; line-height:1.5; color:var(--sys-chat-muted); }
body .sys-chat-panel .sys-chat-room-avatar { width:36px; height:36px; flex:0 0 36px; border-radius:10px; }
body .sys-chat-panel .sys-chat-conversation-header { padding:14px 16px; min-height:72px; }
body .sys-chat-panel .sys-chat-conversation-title-wrap strong { font-size:15px; overflow-wrap:anywhere; }
body .sys-chat-panel .sys-chat-messages { padding:18px; overflow-y:auto; overscroll-behavior:contain; }
body .sys-chat-panel .sys-chat-composer { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:8px 12px; padding:12px 16px; }
body .sys-chat-panel .sys-chat-message-entry { grid-column:1 / -1; min-width:0; border:1px solid var(--sys-chat-border); border-radius:6px; background:var(--sys-chat-surface-alt); padding:0 0 40px; }
body .sys-chat-panel .sys-chat-message-entry:focus-within { border-color:var(--sys-chat-primary); box-shadow:0 0 0 2px var(--sys-chat-hover); }
body .sys-chat-panel .sys-chat-message-entry textarea.form-control { display:block; box-sizing:border-box; width:100%!important; min-height:66px; max-height:160px; padding:12px!important; margin:0!important; border:0!important; border-radius:6px; box-shadow:none!important; background:transparent!important; color:var(--sys-chat-text)!important; font-family:inherit; font-size:13px; line-height:1.5; resize:vertical; }
body .sys-chat-panel .sys-chat-composer > .btn-primary { grid-column:2; grid-row:auto; position:static; min-height:36px; height:36px; margin:0; padding:7px 16px; font-size:13px; }
body .sys-chat-panel .sys-chat-composer-hint { position:static; grid-column:1; grid-row:auto; align-self:center; font-size:11px; line-height:1.5; text-align:left; margin:0; }
body .sys-chat-panel .sys-chat-reply-composer,
body .sys-chat-panel .sys-chat-attachment-preview { grid-column:1 / -1; }
body .sys-chat-panel .sys-chat-message-entry .sys-chat-emoji-button { bottom:5px; min-height:30px; height:30px; width:32px; padding:0; }
body .sys-chat-panel button:focus-visible { outline:2px solid var(--sys-chat-primary); outline-offset:2px; }
@media(max-width:700px) {
 body .sys-chat-panel .sys-chat-layout { grid-template-columns: min(38vw,240px) minmax(0,1fr); }
 body .sys-chat-panel .sys-chat-sidebar-view-tabs { grid-template-columns:1fr; }
 body .sys-chat-panel .sys-chat-room { padding:8px 5px; gap:6px; }
 body .sys-chat-panel .sys-chat-room-avatar { width:28px; height:28px; flex-basis:28px; }
 body .sys-chat-panel .sys-chat-composer { padding:10px; }
 body .sys-chat-panel .sys-chat-composer-hint { grid-column:1 / -1; }
 body .sys-chat-panel .sys-chat-panel-subtitle { display:none; }
}


/* Selected chat section must remain distinct from host-page button styles and focus. */
#sysChatPanel .sys-chat-sidebar-view-tabs button[aria-selected="true"] {
    background: color-mix(in srgb, var(--sys-chat-primary, #3c8dbc) 70%, #102433) !important;
    color: #fff !important;
    border-color: var(--sys-chat-primary, #3c8dbc) !important;
    box-shadow: inset 0 -3px 0 rgba(255,255,255,.8) !important;
}
#sysChatPanel .sys-chat-sidebar-view-tabs button[aria-selected="true"] > span,
#sysChatPanel .sys-chat-sidebar-view-tabs button[aria-selected="true"] > i { color: inherit !important; }
#sysChatPanel .sys-chat-sidebar-view-tabs button:focus-visible { outline: 2px solid var(--sys-chat-primary, #3c8dbc); outline-offset: 2px; }
