.md-chat-dock,
.md-chat-dock *,
.md-chat,
.md-chat * {
    box-sizing: border-box;
}

.md-chat-dock {
    --md-nav: #ffffff;
    --md-text: #191919;
    --md-muted: rgba(0, 0, 0, 0.55);
    --md-line: rgba(0, 0, 0, 0.08);
    --md-page: #f3f2ef;
    --md-pattern: rgba(15, 23, 42, 0.05);
    --md-mine: #e8f3ee;
    --md-mine-text: #191919;
    --md-other: #ffffff;
    --md-other-text: #191919;
    --md-primary: var(--brand-primary, #0a66c2);
    --md-composer: #ffffff;
    --md-composer-icon: #666666;
    --md-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.15);
    --md-dock-h: min(380px, 42dvh);
    --md-people-h: min(720px, 82dvh);
    --md-list-w: min(300px, calc(100vw - 24px));
    --md-thread-w: min(320px, calc(100vw - 24px));
    --md-people-w: min(380px, calc(100vw - 24px));
    position: fixed;
    z-index: 1100;
    inset-inline-end: max(8px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
    bottom: 0;
    display: none;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 8px;
    max-width: calc(100vw - 16px);
    pointer-events: none;
    font-family: "Vazir FD", Tahoma, sans-serif;
    color: var(--md-text);
    direction: ltr;
}

.md-chat-dock.is-open {
    display: flex;
}

.md-chat-dock.is-people-open {
    inset: 0;
    max-width: none;
    width: 100%;
    height: 100%;
    justify-content: flex-end;
    align-items: flex-end;
    padding-inline: max(8px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
    pointer-events: auto;
}

.md-chat-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
}

.layout-theme.theme-dark .md-chat-backdrop,
body.app-dark-mode .md-chat-backdrop {
    background: rgba(0, 0, 0, 0.42);
}

.md-chat-dock.is-people-open .md-chat {
    z-index: 1;
}

.layout-theme.theme-dark .md-chat-dock,
body.app-dark-mode .md-chat-dock {
    --md-nav: #1d2226;
    --md-text: rgba(255, 255, 255, 0.92);
    --md-muted: rgba(255, 255, 255, 0.55);
    --md-line: rgba(255, 255, 255, 0.10);
    --md-page: #000000;
    --md-pattern: rgba(255, 255, 255, 0.05);
    --md-mine: #1b4332;
    --md-mine-text: rgba(255, 255, 255, 0.95);
    --md-other: #38434f;
    --md-other-text: rgba(255, 255, 255, 0.92);
    --md-composer: #1d2226;
    --md-composer-icon: #a4a4a4;
    --md-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.45);
}

.md-chat {
    position: relative !important;
    inset: auto !important;
    display: flex !important;
    flex-direction: row-reverse !important;
    align-items: flex-end !important;
    gap: 8px !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow: visible !important;
    float: none !important;
}

.md-chat-nav,
.md-chat-main {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 0 1 var(--md-list-w) !important;
    width: var(--md-list-w) !important;
    max-width: calc(100vw - 24px) !important;
    height: var(--md-dock-h) !important;
    max-height: min(var(--md-dock-h), 42dvh) !important;
    min-width: 0 !important;
    min-height: 48px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--md-nav);
    color: var(--md-text);
    border: 0 !important;
    border-radius: 8px 8px 0 0 !important;
    box-shadow: var(--md-shadow);
    overflow: hidden !important;
    float: none !important;
    direction: rtl;
    pointer-events: auto;
}

.md-chat-main {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 52px auto minmax(0, 1fr) auto !important;
    grid-template-areas:
        "head"
        "pin"
        "body"
        "composer" !important;
    flex: 0 0 var(--md-people-w) !important;
    width: var(--md-people-w) !important;
    max-width: var(--md-people-w) !important;
    height: var(--md-people-h) !important;
    max-height: var(--md-people-h) !important;
    background: var(--md-page);
}

.md-chat-main.is-people {
    grid-template-rows: 52px auto minmax(0, 1fr) !important;
    grid-template-areas:
        "head"
        "search"
        "body" !important;
    background: var(--md-nav);
    flex: 0 0 var(--md-people-w) !important;
    width: var(--md-people-w) !important;
    max-width: var(--md-people-w) !important;
    height: var(--md-people-h) !important;
    max-height: var(--md-people-h) !important;
}

.md-people-search.md-chat-search {
    grid-area: search;
    padding: 8px 12px 6px;
}

.md-people-label {
    flex: 0 0 auto;
    padding: 2px 12px 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--md-muted);
}

.md-people-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding-bottom: 8px;
}

.md-chat-main.is-people .md-chat-body {
    background-color: var(--md-nav);
    background-image: none;
    padding: 0;
}

.md-chat-main.is-people .md-chat-head,
.md-chat-head.is-people-head {
    padding-inline: 12px !important;
}

.md-chat.is-thread:not(.is-list-min) .md-chat-nav,
.md-chat.is-list:not(.is-list-min):not(:has(.md-chat-main.is-people)) .md-chat-nav {
    max-width: calc((100vw - 40px) / 2) !important;
}

.md-chat.is-thread-min .md-chat-main {
    display: none !important;
}

.md-chat.is-list-min .md-chat-nav {
    height: 48px !important;
}

.md-compose {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 0 1 var(--md-list-w);
    width: var(--md-list-w);
    max-width: calc(100vw - 24px);
    height: var(--md-dock-h);
    max-height: min(var(--md-dock-h), 42dvh);
    min-width: 0;
    min-height: 48px;
    background: var(--md-nav);
    color: var(--md-text);
    border-radius: 8px 8px 0 0;
    box-shadow: var(--md-shadow);
    overflow: hidden;
    direction: rtl;
    pointer-events: auto;
}

.md-compose-head {
    flex: 0 0 48px;
    height: 48px;
    padding: 0 6px 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid var(--md-line);
}

.md-compose-head strong {
    font-size: 16px;
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.md-compose-head .md-chat-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--md-muted);
}

.md-compose-head .md-chat-icon-btn:hover {
    background: color-mix(in srgb, var(--md-text) 8%, transparent);
    color: var(--md-text);
}

.md-compose-search {
    flex: 0 0 auto;
    padding: 12px 16px 8px;
}

.md-compose-input {
    width: 100%;
    border: 1px solid color-mix(in srgb, var(--md-text) 55%, var(--md-line));
    background: var(--md-nav);
    color: var(--md-text);
    border-radius: 999px;
    padding: 9px 16px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    outline: none;
}

.md-compose-input::placeholder {
    color: var(--md-muted);
}

.md-compose-input:focus {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 1px var(--md-primary);
}

.md-compose-label {
    flex: 0 0 auto;
    padding: 6px 16px 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--md-muted);
}

.md-compose-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.md-compose-row {
    width: 100%;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    padding: 8px 12px !important;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start !important;
    direction: rtl;
    cursor: pointer;
}

.md-compose-row:hover {
    background: color-mix(in srgb, var(--md-text) 6%, transparent);
}

.md-compose-row .md-chat-avatar {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    font-size: 16px;
}

.md-compose-row .md-chat-meta {
    flex: 1 1 auto;
    min-width: 0;
}

.md-compose-row .md-chat-title {
    font-size: 14px;
    font-weight: 700;
    justify-content: flex-start;
}

.md-compose-row .md-chat-title > span:first-of-type {
    flex: 1 1 auto;
}

.md-people-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas: "open mute" !important;
    align-items: center !important;
    gap: 8px !important;
    direction: rtl;
    cursor: default;
    padding: 8px 12px !important;
}

.md-people-open {
    grid-area: open;
    min-width: 0;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
    direction: rtl;
    padding: 0;
    cursor: pointer;
}

.md-people-open .md-chat-meta {
    flex: 1 1 auto;
    min-width: 0;
}

.md-people-open .md-chat-avatar {
    flex: 0 0 48px;
}

.md-people-mute {
    grid-area: mute;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--md-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.md-people-mute:hover {
    background: color-mix(in srgb, var(--md-text) 8%, transparent);
    color: var(--md-text);
}

.md-people-mute.is-on {
    color: var(--md-primary);
    background: color-mix(in srgb, var(--md-primary) 12%, transparent);
}

.md-compose-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--md-muted);
    font-size: 13px;
    font-weight: 600;
}

.md-chat.is-list-min .md-chat-nav .md-chat-tabs,
.md-chat.is-list-min .md-chat-nav .md-chat-search,
.md-chat.is-list-min .md-chat-nav .md-chat-list,
.md-chat.is-list-min .md-chat-nav .md-chat-archive-toggle,
.md-chat.is-list-min .md-chat-nav .md-chat-fab,
.md-chat.is-list-min .md-chat-nav .md-chat-panel {
    display: none !important;
}

.md-chat.is-thread-min .md-chat-body,
.md-chat.is-thread-min .md-chat-pin,
.md-chat.is-thread-min .md-chat-composer,
.md-chat.is-thread-min .md-chat-back,
.md-chat.is-thread-min .md-people-search {
    display: none !important;
}

.md-chat-brand {
    flex: 0 0 48px;
    height: 48px;
    padding: 0 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    direction: rtl;
    border-bottom: 1px solid var(--md-line);
}

.md-chat-brand .md-chat-avatar,
.md-brand-avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    font-size: 12px;
    overflow: visible;
}

.md-brand-avatar img {
    border-radius: 50%;
    overflow: hidden;
}

.md-brand-avatar .md-chat-dot {
    inset-inline-start: 0;
    bottom: 0;
    width: 10px;
    height: 10px;
}

.md-chat.is-list-min .md-chat-brand {
    border-bottom: 0;
}

.md-li-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0;
}

.md-chat-brand strong,
.md-li-title strong {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--md-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.md-li-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
    direction: ltr;
}

.md-chat-head .md-li-actions {
    gap: 2px;
    flex: 0 0 auto;
    margin: 0;
}

.md-li-chevron {
    transition: transform 0.16s ease;
}

.md-li-chevron.is-up {
    transform: rotate(180deg);
}

.md-chat-brand .md-chat-icon-btn,
.md-chat-head .md-chat-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--md-muted);
}

.md-chat-brand .md-chat-icon-btn:hover,
.md-chat-head .md-chat-icon-btn:hover,
.md-chat-brand .md-chat-icon-btn.is-on,
.md-chat-head .md-chat-icon-btn.is-on {
    background: color-mix(in srgb, var(--md-text) 8%, transparent);
    color: var(--md-text);
}

.md-chat-tabs {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 0 12px;
    border-radius: 0;
    background: transparent;
    border-bottom: 1px solid var(--md-line);
}

.md-chat-tabs button {
    border: 0;
    background: transparent;
    color: var(--md-muted);
    border-radius: 0;
    padding: 10px 6px 9px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    font-size: 13px;
    transition: color .14s ease;
    box-shadow: inset 0 -2px 0 transparent;
}

.md-chat-tabs button:hover {
    background: transparent;
    color: var(--md-text);
}

.md-chat-tabs button.is-active {
    background: transparent;
    color: var(--md-primary);
    box-shadow: inset 0 -2px 0 var(--md-primary);
}

.md-chat-search {
    flex: 0 0 auto;
    padding: 8px 12px 10px;
    position: relative;
}

.md-chat-search svg {
    position: absolute;
    inset-inline-end: 22px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--md-muted);
    pointer-events: none;
}

.md-chat-search input,
.md-chat-field {
    width: 100%;
    border: 0;
    background: color-mix(in srgb, var(--md-text) 6%, var(--md-nav));
    color: var(--md-text);
    border-radius: 999px;
    padding: 8px 14px;
    outline: none;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
}

.md-chat-search input {
    padding-inline-end: 36px;
}

.md-chat-search input:focus,
.md-chat-field:focus {
    background: color-mix(in srgb, var(--md-text) 9%, var(--md-nav));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--md-primary) 28%, transparent);
}

.md-chat-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 2px 0 8px;
}

.md-chat-item {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 8px 12px;
    padding-inline-end: 32px;
    border-radius: 0;
    cursor: pointer;
    direction: rtl;
    text-align: start;
    transition: background .12s ease;
}

.md-chat-item:hover {
    background: color-mix(in srgb, var(--md-text) 6%, transparent);
}

.md-chat-item.is-active {
    background: color-mix(in srgb, var(--md-primary) 16%, transparent);
}

.md-chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(145deg, color-mix(in srgb, var(--md-primary) 70%, #5ec8f0), var(--md-primary));
    color: #fff;
    font-weight: 900;
    font-size: 16px;
    position: relative;
}

.md-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.md-chat-dot {
    position: absolute;
    inset-inline-start: 1px;
    bottom: 1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid var(--md-nav);
    background: #9aa5b1;
}

.md-chat-dot.is-on {
    background: #22c55e;
}

.md-chat-meta {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 2px;
    text-align: start;
}

.md-chat-title {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-width: 0;
    width: 100%;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.25;
    white-space: nowrap;
    text-align: start;
}

.md-chat-title > span:first-of-type {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: start;
}

.md-chat-title:has(.md-group-chip) > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.md-chat-aside {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    min-width: 40px;
}

.md-chat-seen,
.md-chat-when {
    margin: 0;
    font-style: normal;
    font-weight: 600;
    font-size: 11px;
    line-height: 1;
    color: var(--md-muted);
    white-space: nowrap;
}

.md-chat-sub {
    font-size: 12px;
    line-height: 1.3;
    color: var(--md-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: start;
    width: 100%;
    padding:10px;
}

.md-chat-sub:empty {
    display: none;
}

.md-chat-sub.is-live {
    color: var(--md-primary);
    font-weight: 700;
}

.md-chat-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--md-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.md-chat-mute {
    font-size: 11px;
    line-height: 1;
    opacity: 0.75;
}

.md-chat-fab {
    display: none;
}

.md-chat-fab-btn,
.md-chat-icon-btn,
.md-chat-send,
.md-chat-back,
.md-chat-panel-head button,
.md-chat-bubble-foot button {
    border: 0;
    cursor: pointer;
    font: inherit;
}

.md-chat-fab-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--md-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 28px color-mix(in srgb, var(--md-primary) 42%, transparent);
}

.md-chat-fab-menu {
    position: absolute;
    bottom: 66px;
    inset-inline-end: 0;
    width: 210px;
    background: var(--md-nav);
    border: 1px solid var(--md-line);
    border-radius: 16px;
    box-shadow: var(--md-shadow);
    padding: 6px;
    display: flex;
    flex-direction: column;
}

.md-chat-fab-menu button {
    border: 0;
    background: transparent;
    color: var(--md-text);
    text-align: right;
    padding: 11px 10px;
    border-radius: 12px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.md-chat-fab-menu button:hover {
    background: color-mix(in srgb, var(--md-text) 6%, transparent);
}

.md-chat-panel {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: var(--md-nav);
    display: flex;
    flex-direction: column;
}

.md-chat-panel-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--md-line);
    font-weight: 900;
}

.md-chat-panel-head span {
    flex: 1;
    min-width: 0;
}

.md-chat-panel-head button {
    background: color-mix(in srgb, var(--md-text) 6%, transparent);
    color: var(--md-text);
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.md-chat-panel-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.md-chat-head {
    grid-area: head !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between;
    gap: 8px;
    width: 100% !important;
    height: 52px !important;
    min-height: 52px !important;
    margin: 0 !important;
    padding-block: 0 !important;
    padding-inline: 12px !important;
    background: var(--md-nav) !important;
    color: var(--md-text) !important;
    border: 0 !important;
    border-bottom: 1px solid var(--md-line) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    direction: rtl;
    overflow: hidden;
}

.md-chat-head-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    direction: rtl;
}

.md-chat.is-thread-min .md-chat-head {
    border-bottom: 0 !important;
    padding-inline: 12px !important;
    height: 48px !important;
    min-height: 48px !important;
}

.md-chat-head .md-chat-avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    font-size: 12px;
}

.md-chat-head .md-chat-meta {
    min-width: 0;
    flex: 1 1 auto;
    gap: 0;
    justify-content: center;
}

.md-chat-head .md-chat-title {
    color: var(--md-text);
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    line-height: 1.2;
}

.md-chat-head .md-chat-sub {
    color: var(--md-muted);
    font-size: 11px;
    line-height: 1.2;
}

.md-chat-head .md-chat-sub.is-live {
    color: var(--md-primary);
}

.md-chat-head-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.md-chat-head-info .md-chat-meta {
    min-width: 0;
    flex: 1 1 auto;
    gap: 0;
}

.md-chat-head-info:disabled {
    cursor: default;
}

.md-chat-pin {
    grid-area: pin;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 6px 12px;
    background: color-mix(in srgb, var(--md-nav) 92%, var(--md-primary));
    border-bottom: 1px solid var(--md-line);
}

.md-chat-pin-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    background: transparent;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-align: start;
}

.md-chat-pin-body span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 11px;
    font-weight: 800;
    color: var(--md-primary);
}

.md-chat-pin-body em {
    font-style: normal;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    color: var(--md-text);
}

.md-chat-pin-scope {
    font-size: 10px;
    font-weight: 700;
    color: var(--md-muted);
    padding: 1px 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--md-line) 70%, transparent);
}

.md-pin-choice {
    width: min(360px, 100%);
    max-width: 360px;
    max-height: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
}

.md-pin-choice-text {
    margin: 0 0 4px;
    font-size: 13.5px;
    color: var(--md-muted);
    line-height: 1.5;
}

.md-pin-choice-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--md-line);
    border-radius: 12px;
    background: var(--md-nav);
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-align: start;
}

.md-pin-choice-btn strong {
    font-size: 14px;
    font-weight: 800;
}

.md-pin-choice-btn span {
    font-size: 12px;
    color: var(--md-muted);
}

.md-pin-choice-btn:hover {
    border-color: color-mix(in srgb, var(--md-primary) 45%, var(--md-line));
    background: color-mix(in srgb, var(--md-primary) 6%, var(--md-nav));
}

.md-pin-choice-btn.is-primary {
    border-color: color-mix(in srgb, var(--md-primary) 55%, var(--md-line));
    background: color-mix(in srgb, var(--md-primary) 10%, var(--md-nav));
}

.md-pin-choice-btn.is-primary strong {
    color: var(--md-primary);
}

.md-chat-status {
    margin-inline-start: 0;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--md-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.md-chat-head .md-chat-status {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    margin-inline-end: 2px;
}

.md-chat-status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9aa5b1;
}

.md-chat-status.is-on {
    color: #16a34a;
}

.md-chat-status.is-on::before {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.layout-theme.theme-dark .md-chat-status.is-on,
body.app-dark-mode .md-chat-status.is-on {
    color: #4ade80;
}

.md-chat-back {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--md-line);
    background: transparent;
    color: var(--md-text);
}

.md-chat-body {
    grid-area: body !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
    background-color: var(--md-page);
    background-image: radial-gradient(var(--md-pattern) 1.1px, transparent 1.1px);
    background-size: 22px 22px;
}

.md-chat-empty,
.md-chat-thread {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.md-chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    color: var(--md-muted);
}

.md-chat-empty-icon {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--md-primary) 14%, transparent);
    color: var(--md-primary);
}

.md-chat-empty strong {
    color: var(--md-text);
    font-size: 18px;
}

.md-chat-thread {
    overflow: auto;
    padding: 16px 18px 10px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.md-chat-older {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--md-muted);
    padding: 6px 0 2px;
}

.md-chat-jump {
    position: absolute;
    inset-inline-end: 16px;
    bottom: 14px;
    z-index: 3;
    width: 44px;
    height: 44px;
    border: 1px solid var(--md-line);
    border-radius: 50%;
    background: var(--md-nav);
    color: var(--md-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.md-chat-jump:hover {
    background: color-mix(in srgb, var(--md-primary) 12%, var(--md-nav));
}

.md-chat-jump-badge {
    position: absolute;
    top: -6px;
    inset-inline-start: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--md-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.md-chat-row {
    display: flex !important;
    flex-direction: row !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

.md-chat-row.is-mine {
    justify-content: flex-start !important;
}

.md-chat-row.is-other {
    justify-content: flex-end !important;
}

.md-chat-bubble {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
    width: max-content !important;
    max-width: min(72%, 26.5rem) !important;
    min-width: 0 !important;
    border-radius: 16px !important;
    padding: 7px 11px 5px !important;
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.06);
    position: relative;
    overflow: hidden !important;
}

.md-chat-row.is-mine .md-chat-bubble {
    background: var(--md-mine) !important;
    color: var(--md-mine-text) !important;
    border-bottom-right-radius: 6px !important;
}

.md-chat-row.is-other .md-chat-bubble {
    background: var(--md-other) !important;
    color: var(--md-other-text) !important;
    border: 1px solid color-mix(in srgb, var(--md-line) 70%, transparent);
    border-bottom-left-radius: 6px !important;
}

.md-chat-bubble.is-voice {
    width: min(17.5rem, 72%) !important;
    min-width: min(15rem, 100%) !important;
    max-width: min(20rem, 72%) !important;
    padding: 8px 10px 6px !important;
}

.md-chat-bubble > * {
    max-width: 100%;
    min-width: 0;
}

.md-chat-bubble-head,
.md-chat-fwd {
    max-width: 100%;
}

.md-chat-bubble-head {
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 3px;
    color: var(--md-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.md-chat-fwd {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1px;
    margin-bottom: 5px;
    color: var(--md-primary);
    line-height: 1.35;
}

.md-chat-fwd span,
.md-chat-fwd strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.md-chat-fwd span {
    font-size: 11px;
    font-weight: 700;
    opacity: 0.9;
}

.md-chat-fwd strong {
    font-size: 13.5px;
    font-weight: 800;
}

.md-chat-reacts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.md-chat-react {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--md-line);
    background: color-mix(in srgb, var(--md-nav) 82%, transparent);
    color: inherit;
    border-radius: 999px;
    padding: 2px 8px 3px;
    font: inherit;
    font-size: 14px;
    line-height: 1.2;
    cursor: pointer;
}

.md-chat-react em {
    font-style: normal;
    font-size: 11px;
    font-weight: 800;
    color: var(--md-muted);
}

.md-chat-react.is-mine {
    background: color-mix(in srgb, var(--md-primary) 18%, var(--md-nav));
    border-color: color-mix(in srgb, var(--md-primary) 45%, transparent);
}

.md-chat-react:hover {
    background: color-mix(in srgb, var(--md-text) 8%, var(--md-nav));
}

.md-chat-reply {
    border: 0;
    border-right: 3px solid var(--md-primary);
    background: color-mix(in srgb, var(--md-primary) 10%, transparent);
    border-radius: 8px;
    padding: 6px 8px;
    margin-bottom: 6px;
    font: inherit;
    font-size: 11px;
    color: inherit;
    text-align: inherit;
    display: block;
    width: 100%;
    cursor: pointer;
}

.md-chat-reply:hover {
    background: color-mix(in srgb, var(--md-primary) 18%, transparent);
}

.md-chat-reply:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--md-primary) 55%, transparent);
    outline-offset: 1px;
}

.md-chat-row.is-flash {
    border-radius: 16px;
    animation: md-msg-flash 1.15s ease;
}

@keyframes md-msg-flash {
    0%, 40% {
        background: color-mix(in srgb, var(--md-primary) 22%, transparent);
    }
    100% {
        background: transparent;
    }
}

.md-chat-bubble-text {
    display: block !important;
    width: 100% !important;
    white-space: pre-wrap !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    font-size: 15px;
    line-height: 1.45;
}

.md-chat-inline-link {
    color: #0b6ea8;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
    unicode-bidi: isolate;
}

.md-chat-row.is-mine .md-chat-inline-link {
    color: #0a5f92;
}

.md-chat-row.is-other .md-chat-inline-link {
    color: var(--md-primary);
}

.md-chat-inline-link:hover {
    opacity: 0.88;
}

.md-chat-bubble.is-link {
    min-width: min(16rem, 100%);
}

.md-chat-link-card {
    display: grid;
    grid-template-columns: 4px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 4px 8px 2px;
    margin: 1px 0 2px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    background: color-mix(in srgb, var(--md-primary) 12%, transparent);
    min-width: 0;
}

.md-chat-row.is-mine .md-chat-link-card {
    background: color-mix(in srgb, #0f172a 8%, transparent);
}

.md-chat-link-bar {
    border-radius: 999px;
    background: var(--md-primary);
}

.md-chat-link-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.md-chat-link-body strong {
    font-size: 13px;
    font-weight: 800;
}

.md-chat-link-body em {
    font-style: normal;
    font-size: 11.5px;
    opacity: 0.72;
    direction: ltr;
    unicode-bidi: isolate;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.md-chat-bubble-foot {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 11px;
    color: color-mix(in srgb, currentColor 62%, transparent);
}

.md-chat-bubble-foot button {
    background: transparent;
    color: inherit;
    opacity: 0.75;
    padding: 0 2px;
}

.md-chat-ticks {
    letter-spacing: -1px;
    font-weight: 700;
}

.md-chat-ticks.is-seen {
    color: #4fc3f7;
}

.md-chat-attach img,
.md-chat-attach video {
    display: block;
    max-width: min(100%, 320px);
    border-radius: 12px;
    margin-bottom: 6px;
}

.md-chat-attach a:not(.md-chat-file) {
    color: inherit;
}

.md-chat-bubble.is-photo,
.md-chat-bubble.is-video {
    padding: 0 !important;
    width: max-content !important;
    max-width: min(70%, 22rem) !important;
    overflow: hidden !important;
}

.md-chat-row.is-mine .md-chat-bubble.is-photo:not(.has-caption):not(.has-head),
.md-chat-row.is-mine .md-chat-bubble.is-video:not(.has-caption):not(.has-head) {
    background: transparent !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
}

.md-chat-row.is-other .md-chat-bubble.is-photo:not(.has-caption):not(.has-head),
.md-chat-row.is-other .md-chat-bubble.is-video:not(.has-caption):not(.has-head) {
    background: transparent !important;
    border: 0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
}

.md-chat-bubble.is-photo.has-head .md-chat-bubble-head,
.md-chat-bubble.is-photo.has-head .md-chat-fwd,
.md-chat-bubble.is-photo.has-head .md-chat-reply,
.md-chat-bubble.is-video.has-head .md-chat-bubble-head,
.md-chat-bubble.is-video.has-head .md-chat-fwd,
.md-chat-bubble.is-video.has-head .md-chat-reply {
    margin: 0;
    padding: 8px 10px 6px;
}

.md-chat-bubble.is-photo .md-chat-attach,
.md-chat-bubble.is-video .md-chat-attach {
    margin: 0;
    line-height: 0;
}

.md-chat-bubble.is-photo .md-chat-photo {
    display: block;
    color: inherit;
}

.md-chat-bubble.is-photo .md-chat-attach img,
.md-chat-bubble.is-video .md-chat-attach video {
    width: auto;
    max-width: 100%;
    max-height: min(70vh, 26rem);
    height: auto;
    margin: 0;
    border-radius: 0;
    background: #111827;
}

.md-chat-bubble.is-photo:not(.has-caption) .md-chat-bubble-foot,
.md-chat-bubble.is-video:not(.has-caption) .md-chat-bubble-foot {
    position: absolute;
    inset-inline-start: 8px;
    bottom: 6px;
    margin: 0;
    padding: 2px 7px 3px;
    border-radius: 11px;
    background: rgba(15, 23, 42, 0.42);
    color: #fff;
    z-index: 1;
    pointer-events: none;
}

.md-chat-bubble.is-photo:not(.has-caption) .md-chat-ticks.is-seen,
.md-chat-bubble.is-video:not(.has-caption) .md-chat-ticks.is-seen {
    color: #9be7ff;
}

.md-chat-bubble.is-photo.has-caption .md-chat-bubble-text,
.md-chat-bubble.is-video.has-caption .md-chat-bubble-text {
    padding: 8px 11px 0;
}

.md-chat-bubble.is-photo.has-caption .md-chat-bubble-foot,
.md-chat-bubble.is-video.has-caption .md-chat-bubble-foot {
    padding: 4px 11px 6px;
    margin: 0;
}

.md-chat-file {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 12.5rem;
    max-width: 100%;
    color: inherit;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    padding: 2px 0 4px;
    cursor: pointer;
}

.md-chat-file-ic {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    background: #54a9eb;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.md-chat-file-ic.is-pdf { background: #e53935; }
.md-chat-file-ic.is-word { background: #1e88e5; }
.md-chat-file-ic.is-excel { background: #43a047; }
.md-chat-file-ic.is-ppt { background: #fb8c00; }
.md-chat-file-ic.is-zip { background: #8e24aa; }
.md-chat-file-ic.is-text { background: #546e7a; }
.md-chat-file-ic.is-audio { background: #8e24aa; }
.md-chat-file-ic.is-video { background: #3949ab; }
.md-chat-file-ic.is-image { background: #00897b; }
.md-chat-file-ic.is-file { background: #54a9eb; }

.md-chat-file-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.md-chat-file-meta strong {
    display: block;
    font-size: 13.5px;
    font-weight: 800;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.md-chat-file-meta em {
    font-style: normal;
    font-size: 11px;
    font-weight: 600;
    opacity: 0.72;
}

/* Voice player */
.md-voice-msg {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    color: inherit;
    direction: ltr !important;
}

.md-voice-play {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #54a9eb;
    color: #fff;
    transition: transform .12s ease, background-color .12s ease;
}

.md-voice-play:active {
    transform: scale(0.94);
}

.md-chat-row.is-mine .md-voice-play,
.md-chat-row.is-other .md-voice-play {
    background: #54a9eb;
    color: #fff;
    box-shadow: none;
}

.md-voice-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 0;
}

.md-voice-wave {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 1px;
    height: 20px;
    width: 100%;
    min-height: 20px;
    cursor: pointer;
    touch-action: manipulation;
    direction: ltr !important;
    overflow: hidden;
}

.md-voice-bar {
    display: inline-block;
    flex: 0 0 2px;
    width: 2px !important;
    min-width: 2px !important;
    min-height: 4px !important;
    max-width: 2px;
    border-radius: 1px;
    background: #5b8fb3;
    opacity: 0.55;
    align-self: center;
}

.md-voice-bar.played {
    opacity: 1;
    background: #1d6fa5;
}

.md-chat-row.is-mine .md-voice-bar {
    background: #4f86a8;
    opacity: 0.55;
}

.md-chat-row.is-mine .md-voice-bar.played {
    background: #1a5f8a;
    opacity: 1;
}

.md-chat-row.is-other .md-voice-bar {
    background: #54a9eb;
    opacity: 0.4;
}

.md-chat-row.is-other .md-voice-bar.played {
    background: #2b8cd6;
    opacity: 1;
}

.layout-theme.theme-dark .md-chat-row.is-mine .md-voice-bar,
body.app-dark-mode .md-chat-row.is-mine .md-voice-bar {
    background: rgba(255, 255, 255, 0.38);
}

.layout-theme.theme-dark .md-chat-row.is-mine .md-voice-bar.played,
body.app-dark-mode .md-chat-row.is-mine .md-voice-bar.played {
    background: #fff;
    opacity: 1;
}

.md-voice-meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    direction: ltr !important;
}

.md-voice-info,
.md-voice-time {
    font-size: 11px;
    line-height: 1;
    opacity: 0.78;
    font-variant-numeric: tabular-nums;
    text-align: left;
    unicode-bidi: isolate;
}

.md-voice-speed {
    display: none;
}

.md-voice-audio {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none;
    overflow: hidden;
}

.md-voice-icon {
    display: block;
    width: 14px;
    height: 14px;
    position: relative;
}

.md-voice-icon-play::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 2px;
    border-style: solid;
    border-width: 5px 0 5px 8px;
    border-color: transparent transparent transparent currentColor;
}

.md-voice-msg:not(.playing) .md-voice-icon-pause {
    display: none;
}

.md-voice-msg.playing .md-voice-icon-play {
    display: none;
}

.md-voice-icon-pause::before,
.md-voice-icon-pause::after {
    content: '';
    position: absolute;
    top: 2px;
    width: 3px;
    height: 10px;
    border-radius: 1px;
    background: currentColor;
}

.md-voice-icon-pause::before {
    left: 3px;
}

.md-voice-icon-pause::after {
    right: 3px;
}

.md-voice-msg.playing .md-voice-play {
    box-shadow: none;
}

.md-chat-composer {
    grid-area: composer !important;
    position: relative;
    z-index: 8;
    display: flex !important;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: var(--md-nav) !important;
    border: 0 !important;
    border-top: 1px solid var(--md-line) !important;
    border-radius: 0 !important;
}

.md-chat-composer-reply {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 8px 10px 0;
    background: color-mix(in srgb, var(--md-primary) 10%, var(--md-nav));
    border-radius: 10px;
    padding: 8px 10px;
    border-right: 3px solid var(--md-primary);
}

.md-chat-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 2px;
    min-width: 0;
    direction: ltr;
    height: 54px;
    padding: 0 8px 0 4px;
    overflow: visible;
    position: relative;
    z-index: 9;
}

.md-chat-input {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    height: 54px;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0;
    padding: 0 10px;
    color: var(--md-text);
    font: inherit;
    font-size: 14.5px;
    font-weight: 500;
    direction: rtl;
    text-align: right;
}

.md-chat-input:focus {
    outline: none;
}

.md-chat-icon-btn {
    width: 46px;
    height: 46px;
    border-radius: 0;
    background: transparent;
    color: var(--md-composer-icon);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.md-chat-icon-btn:hover,
.md-chat-icon-btn.is-on {
    background: transparent;
    color: var(--md-text);
}

.md-attach-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    overflow: visible;
    z-index: 20;
}

.md-attach-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: auto;
    width: max-content;
    min-width: 196px;
    max-width: min(260px, calc(100vw - 24px));
    padding: 6px;
    border-radius: 12px;
    background: var(--md-nav);
    color: var(--md-text);
    box-shadow: var(--md-shadow);
    flex-direction: column;
    gap: 2px;
    z-index: 30;
}

.md-attach-wrap.is-open .md-attach-menu {
    display: flex;
}

.md-attach-menu button {
    border: 0;
    background: transparent;
    color: inherit;
    text-align: right;
    padding: 10px 12px;
    border-radius: 8px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.md-attach-menu button:hover {
    background: color-mix(in srgb, var(--md-primary) 12%, transparent);
}

.md-files-drawer,
.md-info,
.md-group-drawer {
    grid-area: 1 / 1 / -1 / -1;
    position: absolute;
    inset: 0;
    z-index: 90;
    display: flex;
    flex-direction: column;
    background: var(--md-nav);
    color: var(--md-text);
    overflow: hidden;
    animation: md-files-drawer-in .18s ease;
}

@keyframes md-files-drawer-in {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: none;
        opacity: 1;
    }
}

.md-files-drawer-head {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 52px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--md-line);
}

.md-files-drawer-title {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.md-files-drawer-title strong {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
}

.md-files-drawer-title span {
    font-size: 11px;
    color: var(--md-muted);
}

.md-files-drawer-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--md-muted);
    font-size: 13px;
}

.md-files-drawer-tree.share-content-tree-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 8px 8px 16px;
}

.md-files-drawer .share-tree-row {
    min-height: 36px;
    padding-top: 4px;
    padding-bottom: 4px;
    gap: 8px;
}

.md-files-drawer .share-tree-label {
    color: var(--md-text);
    font-size: 13px;
    font-weight: 600;
}

.md-files-drawer .share-tree-row.is-file .share-tree-label {
    font-weight: 500;
}

.md-files-drawer .share-tree-badge {
    background: color-mix(in srgb, var(--md-primary) 14%, transparent);
    color: var(--md-primary);
}

.md-files-drawer .share-tree-row:hover {
    background: color-mix(in srgb, var(--md-primary) 10%, transparent);
}

.md-files-drawer .md-chat-alert {
    margin: 12px;
}

.md-chat-file.is-inbox {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 2px 0 4px;
    border-radius: 0;
    background: transparent;
}

.md-chat-wf {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 8px 2px;
    min-width: 180px;
}

.md-chat-wf-ic {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    background: #c9a227;
}

.md-chat-wf.is-rejected .md-chat-wf-ic {
    background: #c62828;
}

.md-chat-wf-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.md-chat-wf-meta strong {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.md-chat-wf-meta em {
    font-style: normal;
    font-size: 11px;
    opacity: 0.78;
}

.md-emoji-wrap {
    position: static;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    overflow: visible;
    z-index: 9;
}

.md-chat-composer.is-emoji-open,
.md-chat-composer.is-emoji-open .md-chat-bar {
    position: static;
}

.md-emoji {
    --ep-bg: var(--md-nav);
    --ep-text: var(--md-text);
    --ep-muted: var(--md-muted);
    --ep-line: var(--md-line);
    --ep-hover: color-mix(in srgb, var(--md-text) 8%, transparent);
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 62px;
    width: auto;
    max-width: none;
    height: min(340px, calc(100% - 128px));
    transform: translateY(8px);
    z-index: 80;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    border: 1px solid var(--ep-line);
    background: var(--ep-bg);
    color: var(--ep-text);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    direction: rtl;
    transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
}

.md-emoji-wrap.is-open .md-emoji {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
}

.md-emoji-top {
    display: flex;
    align-items: center;
    justify-content: stretch;
    gap: 0;
    padding: 0 8px;
    border-bottom: 1px solid var(--ep-line);
    flex: 0 0 44px;
}

.md-emoji-top button {
    flex: 1 1 0;
    border: 0;
    background: transparent;
    color: var(--ep-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    padding: 12px 8px 10px;
    border-radius: 0;
    cursor: pointer;
    box-shadow: inset 0 -2px 0 transparent;
}

.md-emoji-top button:hover {
    color: var(--ep-text);
}

.md-emoji-top button.is-active {
    color: var(--md-primary);
    box-shadow: inset 0 -2px 0 var(--md-primary);
    background: transparent;
}

.md-emoji-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 10px 10px 14px;
}

.md-emoji-section {
    margin-bottom: 16px;
}

.md-emoji-section:last-child {
    margin-bottom: 4px;
}

.md-emoji-section h4 {
    margin: 0 0 8px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ep-muted);
    text-align: start;
}

.md-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
    gap: 4px;
}

.md-emoji-recent {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.md-emoji-recent .md-emoji-cell {
    flex: 0 0 36px;
    width: 36px;
}

.md-emoji-cell {
    border: 0;
    background: transparent;
    border-radius: 8px;
    height: 36px;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.md-emoji-cell:hover {
    background: var(--ep-hover);
}

.md-emoji-empty {
    text-align: center;
    color: var(--ep-muted);
    font-size: 12px;
    padding: 18px 8px;
}

.md-emoji-bottom {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 2px;
    padding: 6px 6px 8px;
    border-top: 1px solid var(--ep-line);
    flex: 0 0 44px;
}

.md-emoji-cat {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.md-emoji-cat:hover {
    background: var(--ep-hover);
}

.md-emoji-cat.is-active {
    background: color-mix(in srgb, var(--md-text) 12%, transparent);
}

.md-emoji-alt {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--ep-muted);
    text-align: center;
}

.md-emoji-alt span {
    font-size: 34px;
    opacity: 0.7;
}

.md-emoji-alt strong {
    color: var(--ep-text);
    font-size: 15px;
}

.md-emoji-alt em {
    font-style: normal;
    font-size: 12px;
}

.md-chat-send,
.md-chat-mic {
    width: 46px;
    height: 46px;
    border-radius: 0;
    background: transparent;
    color: var(--md-composer-icon);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: none;
}

.md-chat-send {
    color: var(--md-primary);
}

.md-chat-send:hover,
.md-chat-mic:hover {
    color: var(--md-text);
    background: transparent;
}

.md-chat-send:disabled,
.md-chat-mic:disabled {
    opacity: 0.45;
}

.md-chat-send.is-rec-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #54a9eb !important;
    color: #fff !important;
    box-shadow: none;
}

.md-chat-send.is-rec-send:hover {
    background: #3d9ae3 !important;
    color: #fff !important;
}

.md-chat-composer.is-recording .md-chat-shell {
    display: none;
}

.md-chat-rec {
    flex: 1 1 auto;
    min-width: 0;
    height: 54px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px;
    direction: ltr;
}

.md-chat-rec-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff3b30;
    flex-shrink: 0;
    animation: md-rec-pulse 1.2s infinite;
}

@keyframes md-rec-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.35; }
    100% { opacity: 1; }
}

.md-chat-rec-timer {
    font-size: 15px;
    font-weight: 600;
    color: var(--md-text);
    font-variant-numeric: tabular-nums;
    min-width: 72px;
}

.md-chat-rec-cancel {
    margin-inline-start: auto;
    border: 0;
    background: transparent;
    color: #6ab3f3;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 8px;
}

.md-chat-rec-cancel:hover {
    color: #8ec5f5;
}

.md-chat-error {
    display: none;
}

.md-chat-alert {
    position: absolute;
    z-index: 14;
    left: 0;
    right: 0;
    bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: min(520px, calc(100% - 28px));
    margin-inline: auto;
    padding: 11px 12px 11px 10px;
    border-radius: 14px;
    background: color-mix(in srgb, #fff 82%, #fee2e2);
    color: var(--md-text);
    border: 1px solid color-mix(in srgb, #ef4444 38%, transparent);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(12px);
    animation: md-alert-in 0.22s ease-out;
}

.layout-theme.theme-dark .md-chat-alert,
body.app-dark-mode .md-chat-alert {
    background: color-mix(in srgb, #7f1d1d 34%, var(--md-nav));
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.42);
}

.md-chat-alert.is-inline {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    width: auto;
    max-width: none;
    margin: 0;
    animation: none;
    box-shadow: none;
}

.md-chat-alert-ic {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(180deg, #f87171, #dc2626);
    box-shadow: 0 6px 14px color-mix(in srgb, #ef4444 40%, transparent);
}

.md-chat-alert-text {
    flex: 1 1 auto;
    min-width: 0;
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.55;
    color: var(--md-text);
}

.md-chat-alert-x {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    margin-top: 1px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--md-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.md-chat-alert-x:hover {
    background: color-mix(in srgb, var(--md-text) 8%, transparent);
    color: var(--md-text);
}

@keyframes md-alert-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.md-chat-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    cursor: pointer;
}

.md-chat-create {
    width: 100% !important;
    border-radius: 14px !important;
    padding: 0 16px !important;
    height: 44px !important;
    font-weight: 800;
    background: var(--md-primary) !important;
    color: #fff !important;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--md-primary) 32%, transparent);
}

.md-chat-create:hover {
    color: #fff !important;
    filter: brightness(1.04);
}

.md-chat-archive-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 12px 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--md-text);
    font: inherit;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
}

.md-chat-archive-toggle.is-on,
.md-chat-archive-toggle:hover {
    background: color-mix(in srgb, var(--md-primary) 14%, transparent);
}

.md-chat-item-more {
    position: absolute;
    inset-inline-end: 4px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--md-muted);
    width: 24px;
    height: 24px;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}

.md-chat-item:hover .md-chat-item-more,
.md-chat-item-more:focus {
    opacity: 1;
}

.md-chat-more-btn {
    font-size: 15px;
    letter-spacing: 1px;
}

.md-chat-row.is-ctx .md-chat-bubble {
    filter: brightness(0.94);
}

.md-ctx-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: transparent;
    pointer-events: auto;
}

.md-ctx {
    position: fixed;
    z-index: 201;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: max-content;
    max-width: min(280px, calc(100vw - 20px));
    pointer-events: auto;
    direction: rtl;
}

.md-ctx-react {
    display: flex;
    align-items: center;
    gap: 1px;
    padding: 5px 7px;
    border-radius: 999px;
    background: var(--md-nav);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
}

.md-ctx-react button {
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
}

.md-ctx-react button:hover {
    background: color-mix(in srgb, var(--md-text) 8%, transparent);
}

.md-ctx-card {
    min-width: 216px;
    padding: 6px;
    border-radius: 12px;
    background: var(--md-nav);
    color: var(--md-text);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.32);
}

.md-ctx-card button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 14.5px;
    font-weight: 600;
    text-align: start;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
}

.md-ctx-card button svg {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    opacity: 0.9;
}

.md-ctx-card button:hover {
    background: color-mix(in srgb, var(--md-text) 8%, transparent);
}

.md-ctx-card button.is-danger {
    color: #ef4444;
}

.md-ctx-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 4px;
    margin-top: 2px;
    border-top: 1px solid var(--md-line);
    font-size: 12px;
    color: var(--md-muted);
}

.md-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    background: rgba(15, 23, 42, 0.38);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    border-radius: 8px 8px 0 0;
    pointer-events: auto;
}

.md-chat-dock > .md-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    border-radius: 0;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.md-overlay.is-centered,
.md-overlay-centered {
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.md-sheet {
    width: min(420px, 100%);
    max-height: min(78vh, 640px);
    overflow: auto;
    background: var(--md-nav);
    color: var(--md-text);
    border-radius: 18px;
    box-shadow: var(--md-shadow);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.md-sheet-lg {
    width: min(460px, 100%);
}

.md-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.md-sheet-title {
    font-weight: 900;
    font-size: 14px;
    padding: 6px 8px 10px;
}

.md-sheet > button:not(.md-pin-choice-btn):not(.md-chat-icon-btn):not(.md-chat-send) {
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    text-align: start;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
}

.md-sheet > button:not(.md-pin-choice-btn):not(.md-chat-icon-btn):not(.md-chat-send):hover,
.md-info-actions button:hover {
    background: color-mix(in srgb, var(--md-text) 7%, transparent);
}

.md-sheet > button.is-danger:not(.md-pin-choice-btn),
.md-info-actions button.is-danger {
    color: #ef4444;
}

.md-forward-list {
    max-height: 42vh;
    overflow: auto;
    /*display: flex;*/
    flex-direction: column;
    gap: 2px;
}

.md-forward-list .md-chat-item {
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
}

.md-forward-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--md-line);
    flex: 0 0 18px;
}

.md-forward-check.is-on {
    border-color: var(--md-primary);
    background: var(--md-primary);
}

.md-info {
    overflow: auto;
}

.md-info-head,
.md-info-profile,
.md-info-bg {
    padding: 14px 16px;
    border-bottom: 1px solid var(--md-line);
}

.md-info-head {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 52px;
    padding: 6px 8px;
    font-size: 14px;
    font-weight: 800;
    border-bottom: 1px solid var(--md-line);
}

.md-info-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.md-info-profile .md-chat-avatar {
    width: 84px;
    height: 84px;
    flex-basis: 84px;
    font-size: 28px;
}

.md-info-profile .md-chat-title {
    justify-content: center;
}

.md-info-notify {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--md-line);
}

.md-info-notify strong {
    display: block;
    font-size: 13.5px;
}

.md-info-notify span {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--md-muted);
}

.md-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
}

.md-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.md-switch-track {
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--md-muted) 28%, transparent);
    border: 1px solid var(--md-line);
    position: relative;
    transition: background .15s ease, border-color .15s ease;
}

.md-switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .16);
    transition: transform .15s ease;
}

.md-switch input:checked + .md-switch-track {
    background: color-mix(in srgb, var(--md-primary) 70%, transparent);
    border-color: color-mix(in srgb, var(--md-primary) 45%, var(--md-line));
}

.md-switch input:checked + .md-switch-track::after {
    transform: translateX(-20px);
}

.md-info-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
}

.md-info-actions button {
    border: 1px solid var(--md-line);
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 800;
    font-size: 12.5px;
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
}

.md-info-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 8px 12px;
}

.md-info-tabs button {
    border: 0;
    background: transparent;
    color: var(--md-muted);
    font: inherit;
    font-weight: 800;
    padding: 8px 0;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.md-info-tabs button.is-active {
    color: var(--md-primary);
    border-bottom-color: var(--md-primary);
}

.md-info-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 10px 12px 16px;
}

.md-info-media {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.md-info-media a {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 10px;
    background: color-mix(in srgb, var(--md-text) 8%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    text-decoration: none;
}

.md-info-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.md-info-files {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 8px 10px;
}

.md-info-files .md-chat-file {
    min-width: 0;
    padding: 8px;
    border-radius: 12px;
}

.md-info-files .md-chat-file:hover {
    background: color-mix(in srgb, var(--md-primary) 10%, transparent);
}

.md-info-file {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
    overflow: hidden;
}

.md-info-file:hover {
    background: color-mix(in srgb, var(--md-text) 6%, transparent);
}

.md-info-file span {
    font-size: 11px;
    color: var(--md-muted);
    direction: ltr;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.md-chat-composer-reply.is-edit {
    border-color: color-mix(in srgb, #f59e0b 55%, var(--md-line));
}

.md-chat-avatar.is-group[data-tone="0"] { background: linear-gradient(145deg, #38bdf8, #0284c7); }
.md-chat-avatar.is-group[data-tone="1"] { background: linear-gradient(145deg, #34d399, #059669); }
.md-chat-avatar.is-group[data-tone="2"] { background: linear-gradient(145deg, #818cf8, #4f46e5); }
.md-chat-avatar.is-group[data-tone="3"] { background: linear-gradient(145deg, #fb7185, #e11d48); }
.md-chat-avatar.is-group[data-tone="4"] { background: linear-gradient(145deg, #fbbf24, #d97706); }

.md-chat-avatar.is-org {
    background: linear-gradient(145deg, #38bdf8, #0369a1);
}

.md-chat-avatar.is-dept {
    background: linear-gradient(145deg, #a78bfa, #6d28d9);
}

.md-group-chip {
    display: inline-flex;
    align-items: center;
    font-style: normal;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--md-primary) 16%, transparent);
    color: var(--md-primary);
    vertical-align: 1px;
}

.md-group-cta {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 2px 0 8px;
    padding: 10px 12px;
    border: 1px dashed color-mix(in srgb, var(--md-primary) 45%, var(--md-line));
    border-radius: 14px;
    background: color-mix(in srgb, var(--md-primary) 8%, transparent);
    color: var(--md-primary);
    font: inherit;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
}

.md-group-cta:hover {
    background: color-mix(in srgb, var(--md-primary) 14%, transparent);
}

.md-group-cta-ic {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--md-primary);
    color: #fff;
    flex: 0 0 36px;
}

.md-chat-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 36px 16px;
    text-align: center;
    color: var(--md-muted);
}

.md-chat-list-empty strong {
    color: var(--md-text);
    font-size: 14px;
}

.md-chat-list-empty span {
    font-size: 12px;
    max-width: 220px;
    line-height: 1.6;
}

.md-chat-list-empty-ic {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    background: color-mix(in srgb, var(--md-primary) 14%, transparent);
    color: var(--md-primary);
}

.md-group-head-next {
    width: auto !important;
    min-width: 64px;
    flex: 0 0 auto;
    padding: 0 14px !important;
    background: var(--md-primary) !important;
    color: #fff !important;
    font-weight: 800;
    font-size: 13px;
}

.md-group-error {
    display: none;
}

.md-group-panel {
    min-width: 0;
    overflow: hidden;
}

.md-group-panel .md-chat-panel-head {
    flex: 0 0 auto;
}

.md-group-panel .md-chat-panel-head span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.md-group-panel .md-chat-panel-body {
    gap: 10px;
    min-height: 0;
}

.md-group-panel .md-chat-panel-body:has(.md-group-pick-list) {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.md-group-chips {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    max-height: 88px;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
    padding: 2px 0 4px;
    margin: 0;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.md-group-chip-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: min(100%, 180px);
    min-width: 0;
    flex: 0 1 auto;
    border: 0;
    background: color-mix(in srgb, var(--md-text) 6%, transparent);
    color: inherit;
    font: inherit;
    padding: 4px 8px 4px 4px;
    border-radius: 999px;
    cursor: pointer;
    position: relative;
}

.md-group-chip-user .md-chat-avatar {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    font-size: 11px;
}

.md-group-chip-user em {
    font-style: normal;
    font-size: 12px;
    font-weight: 700;
    min-width: 0;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.md-group-chip-user > span:last-child {
    color: var(--md-muted);
    font-size: 14px;
    line-height: 1;
    flex: 0 0 auto;
}

.md-group-search {
    flex: 0 0 auto;
    width: 100%;
}

.md-group-pick-list {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    /*display: flex;*/
    flex-direction: column;
    gap: 2px;
    padding-inline-end: 4px;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

.md-group-save,
.md-group-panel .md-chat-create {
    flex: 0 0 auto;
    width: 100%;
    margin-top: 2px;
}

.md-pick {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
    padding: 8px 6px;
    border-radius: 14px;
    cursor: pointer;
}

.md-pick .md-chat-avatar {
    flex: 0 0 46px;
}

.md-pick .md-chat-meta {
    min-width: 0;
    flex: 1 1 auto;
}

.md-pick .md-chat-title > span:first-of-type {
    flex: 1 1 auto;
}

.md-pick .md-chat-seen {
    display: none;
}

.md-pick:hover,
.md-pick.is-on {
    background: color-mix(in srgb, var(--md-primary) 12%, transparent);
}

.md-pick.is-static {
    cursor: default;
}

.md-pick.is-static:hover {
    background: transparent;
}

.md-pick-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--md-line);
    flex: 0 0 22px;
    margin-inline-start: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.md-pick-check.is-on {
    border-color: var(--md-primary);
    background: var(--md-primary);
}

.md-pick-check.is-on::after {
    content: "";
    width: 5px;
    height: 9px;
    margin-top: -1px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.md-group-setup {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    padding: 8px 4px 4px;
    flex: 0 0 auto;
    overflow: hidden;
}

.md-group-setup .md-group-name,
.md-group-setup .md-chat-create {
    max-width: 100%;
    width: 100%;
}

.md-group-setup-edit {
    padding-bottom: 2px;
    gap: 8px;
}

.md-group-setup-edit .md-group-setup-avatar {
    width: 64px !important;
    height: 64px !important;
    flex: 0 0 64px !important;
    font-size: 24px !important;
}

.md-group-setup-avatar {
    width: 88px !important;
    height: 88px !important;
    flex: 0 0 88px !important;
    font-size: 32px !important;
}

.md-group-name {
    border-radius: 16px !important;
    text-align: center;
    font-size: 15px !important;
    font-weight: 800 !important;
}

.md-group-setup-count {
    font-size: 12px;
    font-weight: 800;
    color: var(--md-muted);
}

.md-group-stack {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 6px;
    padding-inline: 8px;
    max-width: 100%;
}

.md-group-stack .md-chat-avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 12px;
    margin-inline-start: -8px;
    border: 2px solid var(--md-nav);
}

.md-group-stack .md-chat-avatar:first-child {
    margin-inline-start: 0;
}

.md-group-stack-more {
    font-size: 11px !important;
    background: color-mix(in srgb, var(--md-text) 18%, var(--md-nav)) !important;
    color: var(--md-text) !important;
}

.md-info-members {
    padding: 4px 12px 12px;
    /*display: flex;*/
    flex-direction: column;
    gap: 2px;
    max-height: 240px;
    overflow: auto;
    border-bottom: 1px solid var(--md-line);
}

.md-info-members-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 6px;
    font-size: 13px;
}

.md-info-members-head span {
    color: var(--md-muted);
    font-size: 12px;
    font-weight: 700;
}

.md-group-owner {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 800;
    color: var(--md-primary);
    background: color-mix(in srgb, var(--md-primary) 14%, transparent);
    border-radius: 999px;
    padding: 3px 8px;
}

@media (max-width: 1280px) {
    .md-chat-dock {
        --md-list-w: min(280px, calc(100vw - 24px));
        --md-thread-w: min(300px, calc(100vw - 24px));
        --md-dock-h: min(340px, 40dvh);
    }
}

@media (max-height: 700px) {
    .md-chat-dock {
        --md-dock-h: min(300px, 38dvh);
    }

    .md-emoji {
        height: min(240px, calc(100% - 120px));
    }
}

@media (max-width: 720px) {
    .md-chat-dock.is-open {
        inset: 0;
        inset-inline-end: 0;
        padding: 0;
        background: rgba(15, 23, 42, 0.28);
        align-items: stretch;
        justify-content: stretch;
        pointer-events: auto;
        max-width: none;
    }

    .md-chat-dock.is-open:has(.md-chat.is-list-min.is-thread-min):not(:has(.md-chat.is-compose)),
    .md-chat-dock.is-open:has(.md-chat.is-thread-min.is-thread):not(:has(.md-chat.is-compose)) {
        inset: auto;
        inset-inline-end: max(8px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
        bottom: 0;
        background: transparent;
        align-items: flex-end;
        justify-content: flex-end;
        width: auto;
        height: auto;
        pointer-events: none;
        max-width: calc(100vw - 16px);
    }

    .md-chat-dock.is-open:has(.md-chat.is-list-min.is-thread-min):not(:has(.md-chat.is-compose)) .md-chat,
    .md-chat-dock.is-open:has(.md-chat.is-thread-min.is-thread):not(:has(.md-chat.is-compose)) .md-chat {
        width: auto !important;
        height: auto !important;
        flex: 0 0 auto !important;
    }

    .md-chat {
        flex: 1 1 auto !important;
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        flex-direction: column !important;
        gap: 0 !important;
    }

    .md-chat-nav,
    .md-chat-main,
    .md-chat.is-thread:not(.is-list-min) .md-chat-nav,
    .md-chat.is-thread:not(.is-list-min) .md-chat-main {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: none !important;
        height: 100% !important;
        max-height: none !important;
        border-radius: 0 !important;
        box-shadow: none;
    }

    .md-chat-brand {
        height: calc(48px + env(safe-area-inset-top, 0px));
        flex-basis: calc(48px + env(safe-area-inset-top, 0px));
        padding-top: env(safe-area-inset-top, 0px);
    }

    .md-chat-head {
        height: calc(52px + env(safe-area-inset-top, 0px)) !important;
        min-height: calc(52px + env(safe-area-inset-top, 0px)) !important;
        padding-top: env(safe-area-inset-top, 0px) !important;
        padding-inline: 12px !important;
    }

    .md-chat-main {
        grid-template-rows: calc(52px + env(safe-area-inset-top, 0px)) auto minmax(0, 1fr) auto !important;
    }

    .md-chat-main.is-people {
        grid-template-rows: calc(52px + env(safe-area-inset-top, 0px)) auto minmax(0, 1fr) !important;
    }

    .md-chat-composer {
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    }

    .md-chat.is-list .md-chat-main,
    .md-chat.is-thread .md-chat-nav {
        display: none !important;
    }

    .md-chat.is-list .md-chat-nav {
        display: flex !important;
    }

    .md-chat.is-list:not(.is-thread-min) .md-chat-main {
        display: grid !important;
    }

    .md-chat.is-list:not(.is-thread-min) .md-chat-nav {
        display: none !important;
    }

    .md-chat.is-compose .md-chat-nav,
    .md-chat.is-compose .md-chat-main {
        display: none !important;
    }

    .md-chat.is-compose .md-compose {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: none !important;
        height: 100% !important;
        max-height: none !important;
        border-radius: 0 !important;
        box-shadow: none;
    }

    .md-compose-head {
        height: calc(48px + env(safe-area-inset-top, 0px));
        flex-basis: calc(48px + env(safe-area-inset-top, 0px));
        padding-top: env(safe-area-inset-top, 0px);
    }

    .md-compose-input {
        font-size: 16px;
    }

    .md-chat.is-list-min .md-chat-nav,
    .md-chat.is-thread-min .md-chat-main {
        flex: 0 0 auto !important;
        height: 48px !important;
        min-height: 48px !important;
        position: relative !important;
        inset: auto !important;
        width: min(360px, calc(100vw - 24px)) !important;
        max-width: calc(100vw - 24px) !important;
        border-radius: 8px 8px 0 0 !important;
        box-shadow: var(--md-shadow);
        padding-top: 0 !important;
    }

    .md-chat.is-list-min .md-chat-brand,
    .md-chat.is-thread-min .md-chat-head {
        height: 48px !important;
        min-height: 48px !important;
        flex-basis: 48px;
        padding-top: 0 !important;
        padding-inline: 12px !important;
    }

    .md-chat.is-thread-min .md-chat-head .md-li-actions {
        gap: 2px;
    }

    .md-chat.is-thread-min .md-chat-main {
        grid-template-rows: 48px !important;
        width: min(400px, calc(100vw - 24px)) !important;
    }

    .md-chat.is-list:not(.is-thread-min):has(.md-group-drawer) .md-chat-nav {
        display: none !important;
    }

    .md-chat-back {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
    }

    .md-chat-input {
        font-size: 16px;
    }

    .md-chat-search input,
    .md-chat-field {
        font-size: 16px;
    }

    .md-chat-list {
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    }

    .md-emoji {
        position: fixed;
        right: 8px;
        left: 8px;
        bottom: calc(58px + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-width: none;
        height: min(52dvh, 380px);
        border-radius: 16px;
    }

    .md-voice-msg {
        width: 100%;
        min-width: 0;
    }

    .md-chat-bubble,
    .md-chat-bubble.is-voice {
        max-width: min(86%, 22rem) !important;
    }

    .md-chat-bubble.is-photo,
    .md-chat-bubble.is-video {
        max-width: min(82%, 18rem) !important;
    }

    .md-chat-bubble.is-voice {
        width: min(17rem, 86%) !important;
        min-width: 0 !important;
    }

    .md-chat-wf {
        min-width: 0;
    }

    .md-chat-item-more {
        opacity: 0.7;
    }

    .md-chat-seen {
        display: none;
    }

    .md-info {
        width: 100%;
        max-height: none;
        border-radius: 0;
    }

    .md-overlay {
        padding: 10px;
        padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
        align-items: flex-end;
        border-radius: 0;
    }

    .md-overlay-centered {
        align-items: center;
        justify-content: center;
        padding: 16px;
        padding-bottom: 16px;
    }

    .md-sheet,
    .md-sheet-lg {
        width: 100%;
        max-width: 100%;
        max-height: min(86dvh, 640px);
        border-radius: 16px 16px 12px 12px;
    }

    .md-group-panel .md-chat-panel-head {
        padding: 10px 12px;
        padding-top: max(10px, env(safe-area-inset-top, 0px));
        gap: 6px;
    }

    .md-group-panel .md-chat-panel-body {
        padding: 10px 10px calc(12px + env(safe-area-inset-bottom, 0px));
        gap: 8px;
    }

    .md-group-chips {
        max-height: 76px;
        gap: 5px;
    }

    .md-group-chip-user {
        max-width: min(100%, 150px);
    }

    .md-group-chip-user em {
        max-width: 84px;
    }

    .md-group-setup-edit .md-group-setup-avatar {
        width: 56px !important;
        height: 56px !important;
        flex: 0 0 56px !important;
        font-size: 20px !important;
    }

    .md-pick {
        gap: 8px;
        padding: 8px 4px;
    }

    .md-pick .md-chat-avatar {
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
        font-size: 13px;
    }

    .md-pick-check {
        width: 20px;
        height: 20px;
        flex: 0 0 20px;
    }

    .md-group-setup-avatar {
        width: 72px !important;
        height: 72px !important;
        flex-basis: 72px !important;
        font-size: 26px !important;
    }

    .md-group-stack .md-chat-avatar {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
        font-size: 11px;
    }

    .md-info-members {
        max-height: min(48dvh, 360px);
        padding-inline: 8px;
    }

    .md-info-members .md-pick {
        padding-inline: 4px;
    }
}

@media (max-width: 480px) {
    .md-chat-tabs button {
        font-size: 12px;
        padding: 8px 4px 7px;
    }

    .md-chat-search {
        padding: 8px 10px 8px;
    }

    .md-chat-item {
        padding: 8px 10px;
        padding-inline-end: 28px;
        gap: 10px;
    }

    .md-chat-avatar {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
        font-size: 13px;
    }

    .md-chat-title {
        font-size: 13px;
    }

    .md-chat-brand .md-chat-icon-btn,
    .md-chat-head .md-chat-icon-btn {
        width: 32px;
        height: 32px;
    }

    .md-chat-head {
        padding-inline: 10px !important;
        gap: 8px;
    }

    .md-chat.is-thread-min .md-chat-head {
        padding-inline: 12px !important;
    }

    .md-chat-head .md-li-actions {
        gap: 3px;
        margin-inline-start: 4px;
    }

    .md-chat-bar {
        height: 48px;
        padding-inline: 2px;
        gap: 0;
    }

    .md-chat-input {
        height: 48px;
        padding-inline: 6px;
        font-size: 16px;
    }

    .md-chat-icon-btn,
    .md-chat-send,
    .md-chat-mic {
        width: 40px;
        height: 40px;
    }

    .md-chat-thread {
        padding: 12px 10px 8px;
    }

    .md-chat-bubble {
        max-width: min(90%, 100%) !important;
        padding: 6px 9px 4px !important;
    }

    .md-chat.is-list-min .md-chat-nav,
    .md-chat.is-thread-min .md-chat-main {
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
    }
}

.md-upload-bubble {
    min-width: min(16.5rem, 100%) !important;
}

.md-upload-bubble .md-chat-file {
    width: 100%;
    cursor: default;
    margin-bottom: 0;
    padding-bottom: 2px;
}

.md-upload-bubble .md-chat-file-meta {
    flex: 1 1 auto;
}

.md-upload-track {
    position: relative;
    height: 3px;
    margin: 1px 0 2px;
    border-radius: 999px;
    background: color-mix(in srgb, currentColor 16%, transparent);
    overflow: hidden;
    direction: ltr;
}

.md-upload-fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--md-primary, #2aabee);
    transition: width .12s linear;
}

.md-upload-track.is-wait .md-upload-fill {
    width: 36%;
    animation: md-upload-slide 1.05s ease-in-out infinite;
}

.md-upload-track.is-send .md-upload-fill {
    width: 100%;
}

@keyframes md-upload-slide {
    0% { transform: translateX(-140%); }
    100% { transform: translateX(340%); }
}

.md-upload-clock {
    display: inline-flex;
    align-items: center;
    opacity: .8;
}

.md-files-drawer .share-tree-row.is-selected {
    background: color-mix(in srgb, var(--md-primary) 18%, transparent);
    box-shadow: inset -3px 0 0 var(--md-primary);
}

.md-files-drawer .share-tree-row.is-selected .share-tree-label {
    font-weight: 800;
    color: var(--md-primary);
}

.md-files-drawer .share-tree-label {
    flex: 1 1 auto;
    min-width: 0;
}

.md-files-drawer .share-tree-check {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin-inline-start: auto;
    border-radius: 50%;
    background: var(--md-primary);
    position: relative;
}

.md-files-drawer .share-tree-check::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 3px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.md-chat-main:has(.md-file-sendbar) .md-files-drawer-tree {
    padding-bottom: 76px;
}

.md-file-sendbar {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--md-nav);
    border-top: 1px solid var(--md-line);
    box-shadow: 0 -10px 24px color-mix(in srgb, #000 18%, transparent);
}

.md-file-sendbar-meta {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.md-file-sendbar-meta strong,
.md-file-sendbar-meta em {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.md-file-sendbar-meta strong {
    font-size: 13px;
    font-weight: 800;
}

.md-file-sendbar-meta em {
    font-style: normal;
    font-size: 11px;
    color: var(--md-muted);
}

.md-file-sendbar .md-chat-create {
    flex: 0 0 auto;
    width: auto !important;
    min-width: 84px;
    height: 36px !important;
    border-radius: 12px !important;
    padding: 0 16px !important;
}
