/**
 * DSTRC Chat frontend styles.
 * Telegram/CRM-style shell with admin-controlled CSS variables.
 */

.dstrc-chat-shortcode-message,
.dstrc-chat-login-shell,
.dstrc-chat-app {
    box-sizing: border-box;
    font-family: var(--dstrc-chat-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif);
}

.dstrc-chat-shortcode-message *,
.dstrc-chat-login-shell *,
.dstrc-chat-app *,
.dstrc-chat-shortcode-message *::before,
.dstrc-chat-login-shell *::before,
.dstrc-chat-app *::before,
.dstrc-chat-shortcode-message *::after,
.dstrc-chat-login-shell *::after,
.dstrc-chat-app *::after {
    box-sizing: border-box;
}

.dstrc-chat-shortcode-message {
    max-width: 760px;
    margin: 20px auto;
    padding: 18px 20px;
    border: 1px solid #d7e8f7;
    border-radius: 14px;
    background: #f5faff;
    color: #1d2327;
}

.dstrc-chat-shortcode-message-warning {
    border-color: #f2d38a;
    background: #fff8e5;
}

.dstrc-chat-shortcode-message strong {
    display: block;
    margin-bottom: 6px;
    font-size: 16px;
}

.dstrc-chat-shortcode-message p {
    margin: 0;
}

.dstrc-chat-login-shell,
.dstrc-chat-app {
    --dstrc-chat-height: 680px;
    --dstrc-chat-primary: #2481cc;
    --dstrc-chat-bg: #ffffff;
    --dstrc-chat-panel-bg: #eef3f8;
    --dstrc-chat-sidebar-bg: #f5f7fb;
    --dstrc-chat-header-bg: #ffffff;
    --dstrc-chat-incoming-bg: #ffffff;
    --dstrc-chat-outgoing-bg: #dff4ff;
    --dstrc-chat-text: #1d2327;
    --dstrc-chat-muted: #718096;
    --dstrc-chat-border: #dfe5ec;
    --dstrc-chat-radius: 18px;
    --dstrc-chat-font-size: 14px;
    --dstrc-chat-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --dstrc-chat-incoming-border: #8ed7d0;
    --dstrc-chat-outgoing-border: #4f95dd;
    --dstrc-chat-sidebar-w: 340px;
    --dstrc-chat-danger: #c2410c;
    --dstrc-chat-success: #15803d;
    --dstrc-chat-shadow: 0 22px 60px rgba(15, 23, 42, 0.14);
    --dstrc-chat-soft-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    --dstrc-chat-inset: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.dstrc-chat-app {
    display: grid;
    grid-template-columns: minmax(260px, var(--dstrc-chat-sidebar-w)) minmax(0, 1fr);
    width: 100%;
    min-height: 520px;
    height: var(--dstrc-chat-height);
    max-height: 88vh;
    overflow: hidden;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 24px;
    background: var(--dstrc-chat-bg);
    box-shadow: var(--dstrc-chat-shadow);
    color: var(--dstrc-chat-text);
    font-size: var(--dstrc-chat-font-size);
    line-height: 1.45;
    isolation: isolate;
}

.dstrc-chat-sidebar {
    display: flex;
    min-width: 0;
    flex-direction: column;
    border-right: 1px solid var(--dstrc-chat-border);
    background: linear-gradient(180deg, color-mix(in srgb, var(--dstrc-chat-sidebar-bg) 95%, #ffffff 5%), var(--dstrc-chat-sidebar-bg));
}

.dstrc-chat-sidebar-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 12px;
}

.dstrc-chat-app-title {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.dstrc-chat-app-subtitle,
.dstrc-chat-contact-role,
.dstrc-chat-dialog-person p,
.dstrc-chat-current-user span {
    color: var(--dstrc-chat-muted);
    font-size: 12px;
    line-height: 1.35;
}

.dstrc-chat-version {
    padding: 3px 8px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 20%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-primary) 10%, #ffffff 90%);
    color: var(--dstrc-chat-primary);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.dstrc-chat-current-user {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin: 0 14px 14px;
    padding: 10px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 18%, transparent);
    border-radius: 17px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 78%, transparent);
    box-shadow: var(--dstrc-chat-inset);
}

.dstrc-chat-current-user strong,
.dstrc-chat-current-user span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-current-user strong {
    font-weight: 800;
}

.dstrc-chat-current-user-text {
    min-width: 0;
}

.dstrc-chat-logout-button {
    appearance: none;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 86%, var(--dstrc-chat-primary) 14%);
    border-radius: 11px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 82%, var(--dstrc-chat-primary) 18%);
    color: var(--dstrc-chat-primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    padding: 6px 8px;
}

.dstrc-chat-search-wrap {
    padding: 0 14px 14px;
}

.dstrc-chat-search {
    display: block;
    width: 100%;
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 96%, #ffffff 4%);
    color: var(--dstrc-chat-text);
    font-size: 14px;
    outline: none;
    box-shadow: var(--dstrc-chat-inset);
}

.dstrc-chat-search:focus {
    border-color: var(--dstrc-chat-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--dstrc-chat-primary) 18%, transparent), var(--dstrc-chat-inset);
}

.dstrc-chat-contact-list {
    min-height: 0;
    flex: 1;
    overflow: auto;
    padding: 0 8px 12px;
    scrollbar-width: thin;
}

.dstrc-chat-contact {
    appearance: none;
    display: grid;
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 11px;
    margin: 2px 0;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 17px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.dstrc-chat-contact:hover,
.dstrc-chat-contact:focus {
    border-color: color-mix(in srgb, var(--dstrc-chat-primary) 14%, transparent);
    background: color-mix(in srgb, var(--dstrc-chat-primary) 8%, transparent);
    outline: none;
}

.dstrc-chat-contact.is-active {
    border-color: color-mix(in srgb, var(--dstrc-chat-primary) 22%, transparent);
    background: color-mix(in srgb, var(--dstrc-chat-primary) 14%, transparent);
    box-shadow: var(--dstrc-chat-inset);
}

.dstrc-chat-contact-body {
    display: block;
    min-width: 0;
}

.dstrc-chat-contact-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-weight: 800;
    line-height: 1.25;
}

.dstrc-chat-contact-name span:first-child,
.dstrc-chat-contact-role,
.dstrc-chat-contact-access {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-contact-access {
    display: block;
    margin-top: 3px;
    color: var(--dstrc-chat-success);
    font-size: 11px;
    font-weight: 700;
}

.dstrc-chat-contact-access.is-readonly {
    color: #9a6700;
}

.dstrc-chat-unread-badge {
    display: inline-flex;
    min-width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--dstrc-chat-primary);
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.dstrc-chat-avatar {
    display: inline-flex;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    background: linear-gradient(135deg, color-mix(in srgb, var(--dstrc-chat-primary) 16%, #ffffff 84%), color-mix(in srgb, var(--dstrc-chat-primary) 28%, #ffffff 72%));
    color: color-mix(in srgb, var(--dstrc-chat-primary) 80%, #000000 20%);
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.dstrc-chat-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dstrc-chat-avatar-small {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 11px;
}

.dstrc-chat-dialog-avatar {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
}

.dstrc-chat-dialog {
    display: flex;
    min-width: 0;
    flex-direction: column;
    background:
        radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--dstrc-chat-primary) 10%, transparent), transparent 26%),
        var(--dstrc-chat-panel-bg);
}

.dstrc-chat-dialog-head {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 74px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--dstrc-chat-border);
    background: color-mix(in srgb, var(--dstrc-chat-header-bg) 88%, transparent);
    backdrop-filter: blur(12px);
}

.dstrc-chat-dialog-person {
    min-width: 0;
}

.dstrc-chat-dialog-person h2 {
    margin: 0;
    overflow: hidden;
    color: var(--dstrc-chat-text);
    font-size: 17px;
    font-weight: 850;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-dialog-person p {
    margin: 2px 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-dialog-actions {
    display: inline-flex;
    gap: 7px;
}

.dstrc-chat-head-button,
.dstrc-chat-mobile-back,
.dstrc-chat-icon-button,
.dstrc-chat-emoji-close,
.dstrc-chat-edit-row button {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--dstrc-chat-border);
    background: color-mix(in srgb, var(--dstrc-chat-bg) 88%, transparent);
    color: var(--dstrc-chat-text);
    cursor: pointer;
    box-shadow: var(--dstrc-chat-inset);
}

.dstrc-chat-head-button,
.dstrc-chat-mobile-back,
.dstrc-chat-icon-button,
.dstrc-chat-emoji-close {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    font-size: 18px;
}

.dstrc-chat-mobile-back {
    display: none;
    font-size: 28px;
    line-height: 1;
}

.dstrc-chat-head-button:disabled,
.dstrc-chat-icon-button:disabled,
.dstrc-chat-attach-button:disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

.dstrc-chat-messages {
    position: relative;
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 10px;
    overflow: auto;
    padding: 18px;
    scrollbar-width: thin;
}

.dstrc-chat-messages.has-messages {
    justify-content: flex-start;
}

.dstrc-chat-message {
    display: flex;
    max-width: min(78%, 680px);
    flex-direction: column;
    gap: 5px;
}

.dstrc-chat-message.is-own {
    align-self: flex-end;
    text-align: left;
}

.dstrc-chat-message.is-incoming {
    align-self: flex-start;
}

.dstrc-chat-message-bubble {
    position: relative;
    padding: 10px 13px 7px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 78%, transparent);
    border-radius: var(--dstrc-chat-radius);
    background: var(--dstrc-message-bg, var(--dstrc-chat-incoming-bg));
    box-shadow: var(--dstrc-chat-soft-shadow);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.dstrc-chat-message.is-own .dstrc-chat-message-bubble {
    background: var(--dstrc-message-bg, var(--dstrc-chat-outgoing-bg));
    border-bottom-right-radius: 8px;
}

.dstrc-chat-message.is-incoming .dstrc-chat-message-bubble {
    border-bottom-left-radius: 8px;
}

.dstrc-chat-message-sender {
    margin-bottom: 3px;
    color: var(--dstrc-chat-primary);
    font-size: 12px;
    font-weight: 800;
}

.dstrc-chat-message-text {
    white-space: normal;
    line-height: 1.52;
}

.dstrc-chat-message-link {
    color: var(--dstrc-chat-primary);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 2px;
}

.dstrc-chat-message-link:hover,
.dstrc-chat-message-link:focus {
    color: color-mix(in srgb, var(--dstrc-chat-primary) 82%, #000000 18%);
    outline: none;
}

.dstrc-chat-message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    margin-top: 4px;
    color: var(--dstrc-chat-muted);
    font-size: 11px;
    line-height: 1.2;
}

.dstrc-chat-read-ticks {
    color: var(--dstrc-chat-primary);
    font-weight: 900;
    letter-spacing: -0.08em;
}

.dstrc-chat-empty-state,
.dstrc-chat-loading,
.dstrc-chat-error,
.dstrc-chat-empty-contacts {
    color: var(--dstrc-chat-muted);
    font-size: 13px;
    line-height: 1.55;
}

.dstrc-chat-empty-state {
    max-width: 390px;
    margin: auto;
    padding: 24px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 70%, transparent);
    border-radius: 22px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 68%, transparent);
    text-align: center;
    box-shadow: var(--dstrc-chat-inset);
}

.dstrc-chat-empty-icon {
    margin-bottom: 10px;
    font-size: 34px;
}

.dstrc-chat-empty-state h3 {
    margin: 0 0 6px;
    color: var(--dstrc-chat-text);
    font-size: 17px;
}

.dstrc-chat-empty-state p {
    margin: 0;
}

.dstrc-chat-loading,
.dstrc-chat-error,
.dstrc-chat-empty-contacts {
    padding: 14px;
}

.dstrc-chat-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 7px;
    border: 2px solid color-mix(in srgb, var(--dstrc-chat-primary) 20%, transparent);
    border-top-color: var(--dstrc-chat-primary);
    border-radius: 50%;
    vertical-align: -2px;
    animation: dstrc-chat-spin 0.7s linear infinite;
}

@keyframes dstrc-chat-spin {
    to { transform: rotate(360deg); }
}

.dstrc-chat-composer {
    position: relative;
    border-top: 1px solid var(--dstrc-chat-border);
    background: color-mix(in srgb, var(--dstrc-chat-header-bg) 90%, transparent);
    backdrop-filter: blur(12px);
}

.dstrc-chat-composer-main {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
    padding: 12px;
}

.dstrc-chat-input {
    display: block;
    width: 100%;
    min-height: 42px;
    max-height: 126px;
    resize: none;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 96%, #ffffff 4%);
    color: var(--dstrc-chat-text);
    font: inherit;
    line-height: 1.45;
    outline: none;
    padding: 10px 13px;
    box-shadow: var(--dstrc-chat-inset);
}

.dstrc-chat-input:focus {
    border-color: var(--dstrc-chat-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--dstrc-chat-primary) 16%, transparent), var(--dstrc-chat-inset);
}

.dstrc-chat-input:disabled {
    cursor: not-allowed;
    opacity: 0.68;
}

.dstrc-chat-send-button {
    appearance: none;
    min-height: 42px;
    min-width: 112px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--dstrc-chat-primary), color-mix(in srgb, var(--dstrc-chat-primary) 76%, #000000 24%));
    box-shadow: 0 10px 24px color-mix(in srgb, var(--dstrc-chat-primary) 24%, transparent);
    color: #ffffff;
    cursor: pointer;
    font-weight: 900;
    padding: 0 16px;
}

.dstrc-chat-send-button:disabled {
    cursor: not-allowed;
    filter: grayscale(0.45);
    opacity: 0.55;
}

.dstrc-chat-emoji-wrap {
    position: relative;
}

.dstrc-chat-emoji-panel {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    z-index: 5;
    width: min(320px, calc(100vw - 36px));
    max-height: 290px;
    overflow: hidden;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 20px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 96%, #ffffff 4%);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.20);
}

.dstrc-chat-emoji-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--dstrc-chat-border);
}

.dstrc-chat-emoji-head strong {
    font-size: 13px;
}

.dstrc-chat-emoji-close {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    font-size: 20px;
}

.dstrc-chat-emoji-grid {
    display: grid;
    max-height: 228px;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    overflow: auto;
    padding: 10px;
}

.dstrc-chat-emoji-item {
    appearance: none;
    display: inline-flex;
    width: 100%;
    aspect-ratio: 1;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    font-size: 20px;
}

.dstrc-chat-emoji-item:hover,
.dstrc-chat-emoji-item:focus {
    background: color-mix(in srgb, var(--dstrc-chat-primary) 12%, transparent);
    outline: none;
}

.dstrc-chat-edit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px 0;
    color: var(--dstrc-chat-primary);
    font-size: 12px;
    font-weight: 800;
}

.dstrc-chat-edit-row button {
    width: 26px;
    height: 26px;
    border-radius: 9px;
}

.dstrc-chat-hide-avatars .dstrc-chat-avatar {
    display: none !important;
}

.dstrc-chat-hide-read-status .dstrc-chat-read-ticks {
    display: none !important;
}

.dstrc-chat-hide-presence .dstrc-chat-dialog-person p {
    max-width: 100%;
}

.dstrc-chat-hide-roles .dstrc-chat-contact-role {
    display: none;
}

.dstrc-chat-compact-contacts .dstrc-chat-contact {
    padding-top: 7px;
    padding-bottom: 7px;
    border-radius: 14px;
}

.dstrc-chat-compact-contacts .dstrc-chat-avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    font-size: 11px;
}

.dstrc-chat-theme-dark,
.dstrc-chat-theme-auto.dstrc-chat-app {
    --dstrc-chat-shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
    --dstrc-chat-soft-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.dstrc-chat-theme-dark.dstrc-chat-app,
.dstrc-chat-theme-dark.dstrc-chat-login-shell {
    --dstrc-chat-bg: #141a22;
    --dstrc-chat-panel-bg: #101820;
    --dstrc-chat-sidebar-bg: #111923;
    --dstrc-chat-header-bg: #151f2a;
    --dstrc-chat-incoming-bg: #1e2937;
    --dstrc-chat-outgoing-bg: #16324a;
    --dstrc-chat-text: #eef6ff;
    --dstrc-chat-muted: #aab8c9;
    --dstrc-chat-border: #2b394a;
}

@media (prefers-color-scheme: dark) {
    .dstrc-chat-theme-auto.dstrc-chat-app,
    .dstrc-chat-theme-auto.dstrc-chat-login-shell {
        --dstrc-chat-bg: #141a22;
        --dstrc-chat-panel-bg: #101820;
        --dstrc-chat-sidebar-bg: #111923;
        --dstrc-chat-header-bg: #151f2a;
        --dstrc-chat-incoming-bg: #1e2937;
        --dstrc-chat-outgoing-bg: #16324a;
        --dstrc-chat-text: #eef6ff;
        --dstrc-chat-muted: #aab8c9;
        --dstrc-chat-border: #2b394a;
    }
}

.dstrc-chat-login-shell {
    position: relative;
    display: flex;
    min-height: min(620px, var(--dstrc-chat-height));
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 24px;
    background:
        radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--dstrc-chat-primary) 22%, transparent), transparent 35%),
        linear-gradient(145deg, var(--dstrc-chat-sidebar-bg), var(--dstrc-chat-panel-bg));
    color: var(--dstrc-chat-text);
    padding: 24px;
}

.dstrc-chat-login-backdrop {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.16), transparent 46%);
    pointer-events: none;
}

.dstrc-chat-login-modal {
    position: relative;
    z-index: 1;
    width: min(430px, 100%);
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 24px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 94%, transparent);
    box-shadow: var(--dstrc-chat-shadow);
    padding: 22px;
}

.dstrc-chat-login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.dstrc-chat-login-logo {
    display: inline-flex;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    border-radius: 17px;
    background: var(--dstrc-chat-primary);
    color: #ffffff;
    font-weight: 900;
}

.dstrc-chat-login-brand h2 {
    margin: 0;
    color: var(--dstrc-chat-text);
}

.dstrc-chat-login-brand p,
.dstrc-chat-login-lead,
.dstrc-chat-login-hint {
    color: var(--dstrc-chat-muted);
}

.dstrc-chat-login-brand p,
.dstrc-chat-login-lead {
    margin: 3px 0 0;
}

.dstrc-chat-login-form {
    display: grid;
    gap: 13px;
    margin-top: 16px;
}

.dstrc-chat-login-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 800;
}

.dstrc-chat-login-field input[type="text"],
.dstrc-chat-login-field input[type="password"] {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 96%, #ffffff 4%);
    color: var(--dstrc-chat-text);
    padding: 9px 12px;
}

.dstrc-chat-login-row {
    display: grid;
    gap: 8px;
}

.dstrc-chat-login-remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.dstrc-chat-login-hint {
    font-size: 12px;
}

.dstrc-chat-login-message {
    min-height: 18px;
    font-size: 13px;
    font-weight: 700;
}

.dstrc-chat-login-message.is-error {
    color: var(--dstrc-chat-danger);
}

.dstrc-chat-login-message.is-success {
    color: var(--dstrc-chat-success);
}

.dstrc-chat-login-message.is-info {
    color: var(--dstrc-chat-primary);
}

.dstrc-chat-login-submit {
    appearance: none;
    min-height: 46px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--dstrc-chat-primary), color-mix(in srgb, var(--dstrc-chat-primary) 75%, #000000 25%));
    color: #ffffff;
    cursor: pointer;
    font-weight: 900;
    padding: 0 18px;
}

.dstrc-chat-preview-shell {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    height: 390px;
    min-height: 390px;
    max-height: 390px;
    border-radius: 18px;
    box-shadow: none;
}

.dstrc-chat-preview-shell .dstrc-chat-contact {
    margin: 10px;
}

.dstrc-chat-preview-shell .dstrc-chat-messages {
    padding: 16px;
}

@media (max-width: 782px) {
    .dstrc-chat-app {
        position: relative;
        display: block;
        min-height: 620px;
        height: min(var(--dstrc-chat-height), calc(100vh - 24px));
        max-height: calc(100vh - 24px);
        border-radius: 18px;
    }

    .dstrc-chat-sidebar,
    .dstrc-chat-dialog {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        transition: transform 0.22s ease;
    }

    .dstrc-chat-sidebar {
        z-index: 2;
        border-right: 0;
        transform: translateX(0);
    }

    .dstrc-chat-dialog {
        z-index: 3;
        transform: translateX(100%);
    }

    .dstrc-chat-app.is-dialog-open .dstrc-chat-sidebar {
        transform: translateX(-28%);
    }

    .dstrc-chat-app.is-dialog-open .dstrc-chat-dialog {
        transform: translateX(0);
    }

    .dstrc-chat-mobile-back {
        display: inline-flex;
    }

    .dstrc-chat-dialog-head {
        grid-template-columns: auto auto minmax(0, 1fr) auto;
        padding: 10px 12px;
    }

    .dstrc-chat-messages {
        padding: 12px;
    }

    .dstrc-chat-message {
        max-width: 88%;
    }

    .dstrc-chat-composer-main {
        grid-template-columns: auto auto minmax(0, 1fr) auto;
        gap: 6px;
        padding: 9px;
    }

    .dstrc-chat-send-button {
        min-width: 46px;
        padding: 0 12px;
        font-size: 0;
    }

    .dstrc-chat-send-button::after {
        content: '➤';
        font-size: 18px;
    }

    .dstrc-chat-emoji-panel {
        left: -48px;
        width: min(310px, calc(100vw - 24px));
    }

    .dstrc-chat-preview-shell {
        display: none;
    }
}

@supports not (color: color-mix(in srgb, #000 50%, #fff 50%)) {
    .dstrc-chat-sidebar { background: var(--dstrc-chat-sidebar-bg); }
    .dstrc-chat-dialog { background: var(--dstrc-chat-panel-bg); }
    .dstrc-chat-dialog-head,
    .dstrc-chat-composer { background: var(--dstrc-chat-header-bg); }
    .dstrc-chat-contact:hover,
    .dstrc-chat-contact:focus,
    .dstrc-chat-contact.is-active { background: rgba(36, 129, 204, 0.12); }
}

.dstrc-chat-hide-avatars .dstrc-chat-contact {
    grid-template-columns: minmax(0, 1fr);
}

.dstrc-chat-hide-avatars .dstrc-chat-current-user {
    grid-template-columns: minmax(0, 1fr) auto;
}

.dstrc-chat-hide-avatars .dstrc-chat-dialog-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
}

/* Attachments: v0.7.0 */
.dstrc-chat-selected-files {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 0 12px 10px;
}

.dstrc-chat-selected-files[hidden] {
    display: none !important;
}

.dstrc-chat-selected-file {
    display: inline-flex;
    min-width: 0;
    max-width: min(100%, 360px);
    align-items: center;
    gap: 7px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 22%, var(--dstrc-chat-border));
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-primary) 9%, var(--dstrc-chat-bg));
    color: var(--dstrc-chat-text);
    font-size: 12px;
    font-weight: 750;
    padding: 6px 7px 6px 10px;
}

.dstrc-chat-selected-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-selected-file-size {
    flex: 0 0 auto;
    color: var(--dstrc-chat-muted);
    font-weight: 650;
}

.dstrc-chat-selected-file-remove {
    appearance: none;
    display: inline-flex;
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--dstrc-chat-danger) 12%, transparent);
    color: var(--dstrc-chat-danger);
    cursor: pointer;
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
}


.dstrc-chat-attachments {
    display: grid;
    gap: 10px;
    margin-top: 8px;
}

.dstrc-chat-message-text + .dstrc-chat-attachments {
    margin-top: 10px;
}

.dstrc-chat-attachment {
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 82%, transparent);
    border-radius: 18px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 68%, transparent);
    box-shadow: var(--dstrc-chat-inset);
}

.dstrc-chat-attachment-preview {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: color-mix(in srgb, var(--dstrc-chat-border) 28%, transparent);
    color: inherit;
    cursor: zoom-in;
    text-align: left;
}

.dstrc-chat-attachment-preview img {
    display: block;
    width: 100%;
    max-width: min(440px, 70vw);
    max-height: 330px;
    object-fit: contain;
}

.dstrc-chat-attachment-zoom {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.58);
    color: #ffffff;
    font-size: 18px;
    font-weight: 900;
    opacity: 0.92;
    pointer-events: none;
}

.dstrc-chat-attachment-body {
    display: grid;
    gap: 7px;
    padding: 10px 11px 11px;
}

.dstrc-chat-attachment-player-card,
.dstrc-chat-attachment-audio-card {
    display: grid;
    gap: 8px;
    padding: 10px;
    background: color-mix(in srgb, var(--dstrc-chat-border) 18%, transparent);
}

.dstrc-chat-attachment-player-head {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--dstrc-chat-muted);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.dstrc-chat-attachment-player-icon,
.dstrc-chat-attachment-audio-icon {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 12px;
    background: color-mix(in srgb, var(--dstrc-chat-primary) 14%, transparent);
    color: var(--dstrc-chat-primary);
    font-size: 16px;
    font-weight: 900;
}

.dstrc-chat-attachment-media,
.dstrc-chat-attachment-audio {
    display: block;
    width: min(440px, 70vw);
    max-width: 100%;
}

.dstrc-chat-attachment-media {
    overflow: hidden;
    border-radius: 14px;
    background: #000000;
}

.dstrc-chat-attachment-audio-card {
    grid-template-columns: auto minmax(180px, 1fr);
    align-items: center;
}

.dstrc-chat-attachment-audio {
    min-width: min(320px, 64vw);
    background: transparent;
}

.dstrc-chat-attachment-file-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px 11px 4px;
}

.dstrc-chat-attachment-file {
    display: inline-flex;
    width: 52px;
    height: 52px;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 16px;
    background: color-mix(in srgb, var(--dstrc-chat-primary) 13%, transparent);
    color: var(--dstrc-chat-primary);
    text-decoration: none;
    font-size: 24px;
}

.dstrc-chat-attachment-meta {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.dstrc-chat-attachment-kind {
    color: var(--dstrc-chat-muted);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.dstrc-chat-attachment-name {
    overflow: hidden;
    color: var(--dstrc-chat-text);
    font-size: 13px;
    font-weight: 850;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-attachment-name:hover,
.dstrc-chat-attachment-name:focus,
.dstrc-chat-attachment-action:hover,
.dstrc-chat-attachment-action:focus,
.dstrc-chat-media-lightbox-link:hover,
.dstrc-chat-media-lightbox-link:focus {
    color: var(--dstrc-chat-primary);
    text-decoration: underline;
}

.dstrc-chat-attachment-size {
    color: var(--dstrc-chat-muted);
    font-size: 11px;
    font-weight: 650;
}

.dstrc-chat-attachment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 11px 11px;
}

.dstrc-chat-attachment-body .dstrc-chat-attachment-actions {
    padding: 0;
}

.dstrc-chat-attachment-action,
.dstrc-chat-media-lightbox-link {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 76%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 84%, transparent);
    color: var(--dstrc-chat-text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    padding: 7px 11px;
    text-decoration: none;
}

.dstrc-chat-attachment-action.is-download,
.dstrc-chat-media-lightbox-link.is-download {
    background: color-mix(in srgb, var(--dstrc-chat-primary) 12%, transparent);
    color: var(--dstrc-chat-primary);
}

.dstrc-chat-media-lightbox {
    position: fixed;
    z-index: 999999;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
}

.dstrc-chat-media-lightbox[hidden] {
    display: none !important;
}

.dstrc-chat-media-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 18, 0.82);
    backdrop-filter: blur(5px);
}

.dstrc-chat-media-lightbox-card {
    position: relative;
    display: grid;
    width: min(1080px, 96vw);
    max-height: min(880px, 94vh);
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 72%, transparent);
    border-radius: 22px;
    background: var(--dstrc-chat-bg);
    color: var(--dstrc-chat-text);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.dstrc-chat-media-lightbox-head,
.dstrc-chat-media-lightbox-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 72%, transparent);
}

.dstrc-chat-media-lightbox-actions {
    justify-content: flex-end;
    border-top: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 72%, transparent);
    border-bottom: 0;
}

.dstrc-chat-media-lightbox-title {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.dstrc-chat-media-lightbox-title strong,
.dstrc-chat-media-lightbox-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-media-lightbox-title strong {
    font-size: 14px;
    font-weight: 900;
}

.dstrc-chat-media-lightbox-title span {
    color: var(--dstrc-chat-muted);
    font-size: 12px;
    font-weight: 700;
}

.dstrc-chat-media-lightbox-close {
    appearance: none;
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--dstrc-chat-danger) 12%, transparent);
    color: var(--dstrc-chat-danger);
    cursor: pointer;
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
}

.dstrc-chat-media-lightbox-stage {
    display: grid;
    min-height: 0;
    place-items: center;
    overflow: auto;
    padding: 14px;
    background: color-mix(in srgb, var(--dstrc-chat-border) 18%, transparent);
}

.dstrc-chat-media-lightbox-stage img {
    display: block;
    max-width: 100%;
    max-height: calc(94vh - 150px);
    object-fit: contain;
    border-radius: 12px;
}

@media (max-width: 782px) {
    .dstrc-chat-attachment-preview img,
    .dstrc-chat-attachment-media,
    .dstrc-chat-attachment-audio {
        width: min(100%, calc(100vw - 76px));
        max-width: 100%;
    }

    .dstrc-chat-attachment-audio-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .dstrc-chat-attachment-audio-icon {
        display: none;
    }

    .dstrc-chat-media-lightbox {
        padding: 10px;
    }

    .dstrc-chat-media-lightbox-card {
        width: 100%;
        max-height: 96vh;
        border-radius: 18px;
    }

    .dstrc-chat-media-lightbox-head,
    .dstrc-chat-media-lightbox-actions {
        padding: 10px;
    }

    .dstrc-chat-selected-files {
        padding: 0 9px 9px;
    }
}


/* v0.7.1 design corrections: font choices, S/M/L modes, left-side bubbles with distinct borders. */
.dstrc-chat-size-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 86%, transparent);
    box-shadow: var(--dstrc-chat-inset);
}

.dstrc-chat-size-button,
.dstrc-chat-preview-size-switch span {
    appearance: none;
    display: inline-flex;
    min-width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--dstrc-chat-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.dstrc-chat-size-button.is-active,
.dstrc-chat-size-button[aria-pressed="true"],
.dstrc-chat-preview-size-switch span.is-active {
    background: color-mix(in srgb, var(--dstrc-chat-primary) 16%, transparent);
    color: var(--dstrc-chat-primary);
}

.dstrc-chat-size-s {
    --dstrc-chat-font-size: 13px;
    font-size: 13px;
}

.dstrc-chat-size-m {
    --dstrc-chat-font-size: 14px;
    font-size: 14px;
}

.dstrc-chat-size-l {
    --dstrc-chat-font-size: 16px;
    font-size: 16px;
}

.dstrc-chat-size-s .dstrc-chat-sidebar-head {
    padding: 14px 14px 10px;
}

.dstrc-chat-size-s .dstrc-chat-current-user,
.dstrc-chat-size-s .dstrc-chat-contact {
    padding: 8px;
    border-radius: 14px;
}

.dstrc-chat-size-s .dstrc-chat-message-bubble {
    padding: 8px 11px 6px;
}

.dstrc-chat-size-s .dstrc-chat-composer-main {
    padding: 9px;
}

.dstrc-chat-size-l .dstrc-chat-sidebar-head {
    padding: 22px 20px 14px;
}

.dstrc-chat-size-l .dstrc-chat-current-user,
.dstrc-chat-size-l .dstrc-chat-contact {
    padding: 12px;
}

.dstrc-chat-size-l .dstrc-chat-message-bubble {
    padding: 13px 16px 9px;
}

.dstrc-chat-size-l .dstrc-chat-input {
    min-height: 48px;
}

.dstrc-chat-align-all-left .dstrc-chat-message {
    max-width: min(88%, 740px);
    align-self: flex-start;
}

.dstrc-chat-align-all-left .dstrc-chat-message.is-own {
    align-self: flex-start;
    margin-left: clamp(22px, 5vw, 58px);
    text-align: left;
}

.dstrc-chat-align-all-left .dstrc-chat-message.is-incoming {
    align-self: flex-start;
    margin-left: 0;
}

.dstrc-chat-align-all-left .dstrc-chat-message.is-own .dstrc-chat-message-bubble,
.dstrc-chat-align-all-left .dstrc-chat-message.is-incoming .dstrc-chat-message-bubble {
    border-radius: var(--dstrc-chat-radius);
    border-left-width: 4px;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: var(--dstrc-chat-radius);
}

.dstrc-chat-message.is-incoming .dstrc-chat-message-bubble {
    border-color: color-mix(in srgb, var(--dstrc-chat-incoming-border) 62%, var(--dstrc-chat-border) 38%);
    border-left-color: var(--dstrc-chat-incoming-border);
}

.dstrc-chat-message.is-own .dstrc-chat-message-bubble {
    border-color: color-mix(in srgb, var(--dstrc-chat-outgoing-border) 55%, var(--dstrc-chat-border) 45%);
    border-left-color: var(--dstrc-chat-outgoing-border);
}

.dstrc-chat-align-all-left .dstrc-chat-message.is-own .dstrc-chat-message-sender::before {
    content: 'Я · ';
}

.dstrc-chat-align-split .dstrc-chat-message.is-own {
    align-self: flex-end;
}

.dstrc-chat-align-split .dstrc-chat-message.is-own .dstrc-chat-message-bubble {
    border-bottom-right-radius: 8px;
    border-left-width: 1px;
}

.dstrc-chat-align-split .dstrc-chat-message.is-incoming .dstrc-chat-message-bubble {
    border-bottom-left-radius: 8px;
    border-left-width: 1px;
}

.dstrc-chat-admin-size-modes {
    display: grid;
    max-width: 760px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.dstrc-chat-admin-size-mode {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 9px;
    align-items: start;
    padding: 12px;
    border: 1px solid #dcdcde;
    border-radius: 12px;
    background: #fff;
}

.dstrc-chat-admin-size-mode strong {
    font-size: 18px;
    line-height: 1;
}

.dstrc-chat-admin-size-mode span {
    grid-column: 2;
    color: #646970;
    font-size: 12px;
    line-height: 1.35;
}

@media (max-width: 782px) {
    .dstrc-chat-size-switch {
        display: none;
    }

    .dstrc-chat-align-all-left .dstrc-chat-message,
    .dstrc-chat-align-all-left .dstrc-chat-message.is-own {
        max-width: 94%;
        margin-left: 0;
    }

    .dstrc-chat-admin-size-modes {
        grid-template-columns: 1fr;
    }
}

/* v0.7.3 CRM-style workspace controls: S/M/L window sizes, separate font size, sound controls, popup window and browser notifications. */
.dstrc-chat-shell {
    width: 100%;
    position: relative;
    font-family: var(--dstrc-chat-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif);
    color: var(--dstrc-chat-text);
}

.dstrc-chat-shell *,
.dstrc-chat-shell *::before,
.dstrc-chat-shell *::after {
    box-sizing: border-box;
}

.dstrc-chat-shell .dstrc-chat-app {
    margin-right: auto;
    margin-left: auto;
}

.dstrc-chat-app[hidden] {
    display: none !important;
}

.dstrc-chat-sidebar-badges {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.dstrc-chat-total-badge {
    display: inline-flex;
    min-width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    border-radius: 999px;
    background: #d9334f;
    color: #ffffff;
    font-size: 11px;
    font-weight: 950;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(217, 51, 79, 0.25);
}

.dstrc-chat-total-badge[hidden] {
    display: none !important;
}

.dstrc-chat-app.has-unread {
    border-color: color-mix(in srgb, #d9334f 32%, var(--dstrc-chat-border) 68%);
}

/* S/M/L here is the chat working field size, not the font size. */
.dstrc-chat-app.dstrc-chat-size-s,
.dstrc-chat-app.dstrc-chat-size-m,
.dstrc-chat-app.dstrc-chat-size-l {
    font-size: var(--dstrc-chat-font-size) !important;
}

.dstrc-chat-app.dstrc-chat-size-s {
    max-width: 780px;
    height: min(560px, 82vh);
    min-height: 430px;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
}

.dstrc-chat-app.dstrc-chat-size-m {
    max-width: 1060px;
    height: var(--dstrc-chat-height, 680px);
    min-height: 520px;
    grid-template-columns: minmax(260px, var(--dstrc-chat-sidebar-w)) minmax(0, 1fr);
}

.dstrc-chat-app.dstrc-chat-size-l {
    max-width: 1360px;
    height: min(86vh, 860px);
    min-height: 640px;
    grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
}

.dstrc-chat-font-control,
.dstrc-chat-sound-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 4px 7px;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 88%, transparent);
    box-shadow: var(--dstrc-chat-inset);
}

.dstrc-chat-font-control input[type="range"] {
    width: 86px;
    accent-color: var(--dstrc-chat-primary);
}

.dstrc-chat-sound-control input[type="range"] {
    width: 92px;
    accent-color: var(--dstrc-chat-primary);
}

.dstrc-chat-font-label,
.dstrc-chat-font-value,
.dstrc-chat-sound-value {
    color: var(--dstrc-chat-muted);
    font-size: 11px;
    font-weight: 850;
    white-space: nowrap;
}

.dstrc-chat-sound-toggle,
.dstrc-chat-sound-preview {
    appearance: none;
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 10px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 92%, transparent);
    color: var(--dstrc-chat-text);
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
}

.dstrc-chat-sound-toggle.is-off {
    opacity: .62;
}

/* CRM-like message cloud finish: pastel bubbles, soft shadow, distinct left border. */
.dstrc-chat-messages {
    gap: 12px;
    background: color-mix(in srgb, var(--dstrc-chat-panel-bg) 92%, #ffffff 8%);
}

.dstrc-chat-message {
    max-width: min(88%, 760px);
}

.dstrc-chat-align-all-left .dstrc-chat-message,
.dstrc-chat-align-all-left .dstrc-chat-message.is-own,
.dstrc-chat-align-all-left .dstrc-chat-message.is-incoming {
    align-self: flex-start;
    text-align: left;
}

.dstrc-chat-align-all-left .dstrc-chat-message.is-own {
    margin-left: clamp(20px, 4.6vw, 64px);
}

.dstrc-chat-message-bubble {
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid rgba(120, 142, 174, .18);
    box-shadow: 0 10px 24px rgba(33, 47, 74, 0.08);
}

.dstrc-chat-message.is-incoming .dstrc-chat-message-bubble {
    background: var(--dstrc-message-bg, var(--dstrc-chat-incoming-bg));
    border-color: color-mix(in srgb, var(--dstrc-chat-incoming-border) 54%, var(--dstrc-chat-border) 46%);
    border-left: 4px solid var(--dstrc-chat-incoming-border);
    border-bottom-left-radius: 8px;
}

.dstrc-chat-message.is-own .dstrc-chat-message-bubble {
    background: var(--dstrc-message-bg, var(--dstrc-chat-outgoing-bg));
    border-color: color-mix(in srgb, var(--dstrc-chat-outgoing-border) 54%, var(--dstrc-chat-border) 46%);
    border-left: 4px solid var(--dstrc-chat-outgoing-border);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 18px;
}

.dstrc-chat-align-split .dstrc-chat-message.is-own .dstrc-chat-message-bubble {
    border-left-width: 1px;
    border-right: 4px solid var(--dstrc-chat-outgoing-border);
    border-bottom-right-radius: 8px;
}

.dstrc-chat-message-sender {
    margin-bottom: 4px;
    font-size: calc(var(--dstrc-chat-font-size) - 2px);
}

.dstrc-chat-message-text {
    line-height: 1.55;
}

.dstrc-chat-message-meta {
    font-size: calc(var(--dstrc-chat-font-size) - 3px);
}

.dstrc-chat-theme-dark .dstrc-chat-font-control,
.dstrc-chat-theme-dark .dstrc-chat-sound-control,
.dstrc-chat-theme-dark .dstrc-chat-sound-toggle,
.dstrc-chat-theme-dark .dstrc-chat-sound-preview {
    background: rgba(29, 35, 33, 0.96);
    color: #f6fbf8;
    border-color: rgba(247, 252, 249, 0.42);
}

.dstrc-chat-theme-dark .dstrc-chat-message.is-own .dstrc-chat-message-bubble {
    background: rgba(96, 71, 140, 0.72);
    border-color: rgba(255,255,255,.24);
    border-left-color: #b7a3eb;
    color: #ffffff;
}

.dstrc-chat-theme-dark .dstrc-chat-message.is-incoming .dstrc-chat-message-bubble {
    background: rgba(41, 112, 106, 0.78);
    border-color: rgba(255,255,255,.24);
    border-left-color: #8ed7d0;
    color: #ffffff;
}

@media (max-width: 980px) {
    .dstrc-chat-dialog-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .dstrc-chat-font-control input[type="range"],
    .dstrc-chat-sound-control input[type="range"] {
        width: 72px;
    }
}

@media (max-width: 720px) {
    .dstrc-chat-app.dstrc-chat-size-s,
    .dstrc-chat-app.dstrc-chat-size-m,
    .dstrc-chat-app.dstrc-chat-size-l {
        max-width: 100%;
        height: min(82vh, calc(100vh - 24px));
        min-height: 520px;
        grid-template-columns: 1fr;
    }

    .dstrc-chat-font-control,
    .dstrc-chat-sound-control {
        display: none;
    }

    .dstrc-chat-align-all-left .dstrc-chat-message.is-own {
        margin-left: 16px;
    }
}

/* v0.7.3 detached popup window and browser notification controls. */
html.dstrc-chat-popup-window,
html.dstrc-chat-popup-window body,
body.dstrc-chat-popup-body {
    min-height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--dstrc-chat-panel-bg, #eef3f8) !important;
}

body.dstrc-chat-popup-body #wpadminbar {
    display: none !important;
}

.dstrc-chat-popup-root {
    min-height: 100vh;
    padding: 10px;
    background: radial-gradient(circle at 15% 10%, rgba(36, 129, 204, .12), transparent 32%), var(--dstrc-chat-panel-bg, #eef3f8);
}

.dstrc-chat-popup-body .dstrc-chat-shell,
.dstrc-chat-popup-root .dstrc-chat-shell {
    width: 100%;
    min-height: calc(100vh - 20px);
}

.dstrc-chat-popup-body .dstrc-chat-app,
.dstrc-chat-popup-root .dstrc-chat-app {
    width: 100% !important;
    max-width: none !important;
    height: calc(100vh - 20px) !important;
    max-height: none !important;
    min-height: 520px;
    border-radius: 18px;
}

.dstrc-chat-detached-notice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 12px;
    width: min(100%, 920px);
    margin: 0 auto;
    padding: 14px 16px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 28%, var(--dstrc-chat-border) 72%);
    border-radius: 20px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--dstrc-chat-bg) 96%, #ffffff 4%), color-mix(in srgb, var(--dstrc-chat-sidebar-bg) 88%, #ffffff 12%));
    color: var(--dstrc-chat-text);
    box-shadow: var(--dstrc-chat-soft-shadow);
}

.dstrc-chat-detached-notice[hidden] {
    display: none !important;
}

.dstrc-chat-detached-icon {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: color-mix(in srgb, var(--dstrc-chat-primary) 14%, transparent);
    color: var(--dstrc-chat-primary);
    font-size: 20px;
    font-weight: 900;
}

.dstrc-chat-detached-body {
    min-width: 0;
}

.dstrc-chat-detached-body strong,
.dstrc-chat-detached-body span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-detached-body strong {
    font-weight: 900;
}

.dstrc-chat-detached-body span {
    color: var(--dstrc-chat-muted);
    font-size: 12px;
}

.dstrc-chat-detached-button {
    appearance: none;
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 90%, transparent);
    color: var(--dstrc-chat-text);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 850;
}

.dstrc-chat-detached-button:hover,
.dstrc-chat-detached-button:focus {
    outline: none;
    border-color: var(--dstrc-chat-primary);
    color: var(--dstrc-chat-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--dstrc-chat-primary) 16%, transparent);
}

.dstrc-chat-theme-dark .dstrc-chat-detached-notice,
.dstrc-chat-theme-dark .dstrc-chat-detached-button {
    background: rgba(29, 35, 33, 0.96);
    color: #f6fbf8;
    border-color: rgba(247, 252, 249, 0.32);
}

.dstrc-chat-theme-dark .dstrc-chat-detached-body span {
    color: rgba(246, 251, 248, .72);
}

@media (max-width: 720px) {
    .dstrc-chat-detached-notice {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .dstrc-chat-detached-notice .dstrc-chat-total-badge,
    .dstrc-chat-detached-button {
        grid-column: 1 / -1;
        width: 100%;
    }
}

.dstrc-chat-shell.has-unread .dstrc-chat-detached-notice {
    border-color: color-mix(in srgb, #d9334f 38%, var(--dstrc-chat-border) 62%);
}

/* v0.8.0 — message editing UI. */
.dstrc-chat-message-edit,
.dstrc-chat-message-delete {
    appearance: none;
    position: absolute;
    top: 6px;
    right: 8px;
    display: inline-flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 78%, transparent);
    border-radius: 9px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 88%, transparent);
    color: var(--dstrc-chat-muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    opacity: 0;
    transform: translateY(-1px);
    transition: opacity .16s ease, color .16s ease, border-color .16s ease, background .16s ease;
}

.dstrc-chat-message-delete {
    top: 34px;
    color: var(--dstrc-chat-danger, #d63638);
}

.dstrc-chat-message-bubble:hover .dstrc-chat-message-edit,
.dstrc-chat-message-bubble:focus-within .dstrc-chat-message-edit,
.dstrc-chat-message.is-editing .dstrc-chat-message-edit,
.dstrc-chat-message-bubble:hover .dstrc-chat-message-delete,
.dstrc-chat-message-bubble:focus-within .dstrc-chat-message-delete,
.dstrc-chat-message.is-editing .dstrc-chat-message-delete {
    opacity: 1;
}

.dstrc-chat-message-edit:hover,
.dstrc-chat-message-edit:focus,
.dstrc-chat-message-delete:hover,
.dstrc-chat-message-delete:focus {
    border-color: var(--dstrc-chat-primary);
    background: color-mix(in srgb, var(--dstrc-chat-primary) 14%, var(--dstrc-chat-bg) 86%);
    color: var(--dstrc-chat-primary);
    outline: none;
}

.dstrc-chat-message.is-editing .dstrc-chat-message-bubble {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--dstrc-chat-primary) 28%, transparent), var(--dstrc-chat-soft-shadow);
}

.dstrc-chat-edit-row.is-active {
    border-top: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 16%, transparent);
    background: color-mix(in srgb, var(--dstrc-chat-primary) 8%, transparent);
    padding-bottom: 8px;
}

.dstrc-chat-edit-row button {
    appearance: none;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 28%, transparent);
    background: color-mix(in srgb, var(--dstrc-chat-bg) 88%, transparent);
    color: var(--dstrc-chat-primary);
    cursor: pointer;
    font-weight: 900;
}

.dstrc-chat-edit-row button:hover,
.dstrc-chat-edit-row button:focus {
    background: color-mix(in srgb, var(--dstrc-chat-primary) 14%, var(--dstrc-chat-bg) 86%);
    outline: none;
}

.dstrc-chat-theme-dark .dstrc-chat-message-edit,
.dstrc-chat-theme-dark .dstrc-chat-message-delete {
    background: rgba(24, 28, 34, .88);
    color: rgba(255, 255, 255, .72);
}

/* v0.9.0 — scheduled messages. */
.dstrc-chat-composer .dstrc-chat-schedule-toggle {
    border-color: color-mix(in srgb, var(--dstrc-chat-primary) 18%, var(--dstrc-chat-border) 82%);
}

.dstrc-chat-schedule-toggle.is-active {
    border-color: var(--dstrc-chat-primary);
    background: color-mix(in srgb, var(--dstrc-chat-primary) 14%, var(--dstrc-chat-bg) 86%);
    color: var(--dstrc-chat-primary);
}

.dstrc-chat-schedule-panel {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 16%, transparent);
    background: color-mix(in srgb, var(--dstrc-chat-primary) 7%, transparent);
}

.dstrc-chat-schedule-panel.is-active {
    display: flex;
}

.dstrc-chat-schedule-panel label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--dstrc-chat-muted);
    font-size: calc(var(--dstrc-chat-font-size) - 1px);
    font-weight: 800;
}

.dstrc-chat-schedule-panel input[type="datetime-local"] {
    min-width: 210px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 22%, var(--dstrc-chat-border) 78%);
    border-radius: 12px;
    background: var(--dstrc-chat-bg);
    color: var(--dstrc-chat-text);
    font-family: inherit;
    font-size: calc(var(--dstrc-chat-font-size) - 1px);
    padding: 8px 10px;
}

.dstrc-chat-schedule-panel button {
    appearance: none;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 26%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 88%, transparent);
    color: var(--dstrc-chat-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: calc(var(--dstrc-chat-font-size) - 1px);
    font-weight: 900;
    padding: 8px 10px;
}

.dstrc-chat-schedule-panel button:hover,
.dstrc-chat-schedule-panel button:focus {
    background: color-mix(in srgb, var(--dstrc-chat-primary) 14%, var(--dstrc-chat-bg) 86%);
    outline: none;
}

.dstrc-chat-schedule-hint {
    color: var(--dstrc-chat-muted);
    font-size: calc(var(--dstrc-chat-font-size) - 2px);
}

.dstrc-chat-message.is-status-scheduled .dstrc-chat-message-bubble {
    border-style: dashed;
    border-color: color-mix(in srgb, #f0a500 58%, var(--dstrc-chat-border) 42%);
    background: color-mix(in srgb, #fff4cc 38%, var(--dstrc-chat-bg) 62%);
}

.dstrc-chat-message.is-status-failed .dstrc-chat-message-bubble {
    border-color: color-mix(in srgb, #d93025 62%, var(--dstrc-chat-border) 38%);
    background: color-mix(in srgb, #ffe7e5 42%, var(--dstrc-chat-bg) 58%);
}

.dstrc-chat-message.is-status-cancelled .dstrc-chat-message-bubble {
    border-style: dashed;
    opacity: .74;
}

.dstrc-chat-message-status-note {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--dstrc-chat-muted);
    font-size: calc(var(--dstrc-chat-font-size) - 2px);
    font-weight: 800;
}

.dstrc-chat-message.is-status-scheduled .dstrc-chat-message-status-note {
    color: color-mix(in srgb, #a66b00 74%, var(--dstrc-chat-muted) 26%);
}

.dstrc-chat-message.is-status-failed .dstrc-chat-message-status-note {
    color: color-mix(in srgb, #b3261e 82%, var(--dstrc-chat-muted) 18%);
}

.dstrc-chat-message-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.dstrc-chat-message-actions button {
    appearance: none;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 22%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 86%, transparent);
    color: var(--dstrc-chat-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: calc(var(--dstrc-chat-font-size) - 2px);
    font-weight: 900;
    line-height: 1.1;
    padding: 6px 9px;
}

.dstrc-chat-message-actions button:hover,
.dstrc-chat-message-actions button:focus {
    background: color-mix(in srgb, var(--dstrc-chat-primary) 13%, var(--dstrc-chat-bg) 87%);
    outline: none;
}

.dstrc-chat-theme-dark .dstrc-chat-message.is-status-scheduled .dstrc-chat-message-bubble {
    background: color-mix(in srgb, #4b3a10 46%, var(--dstrc-chat-bg) 54%);
}

.dstrc-chat-theme-dark .dstrc-chat-message.is-status-failed .dstrc-chat-message-bubble {
    background: color-mix(in srgb, #4a1f1c 48%, var(--dstrc-chat-bg) 52%);
}

@media (max-width: 720px) {
    .dstrc-chat-schedule-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .dstrc-chat-schedule-panel label,
    .dstrc-chat-schedule-panel input[type="datetime-local"],
    .dstrc-chat-schedule-panel button {
        width: 100%;
    }
}

/* v0.9.1 — точечная доводка UX по CRM: настройки справа, inline editing/scheduling, app-mode controls. */
.dstrc-chat-app {
    grid-template-columns: minmax(240px, var(--dstrc-chat-sidebar-w)) minmax(0, 1fr) 128px;
    max-height: min(var(--dstrc-chat-height), calc(100vh - 28px));
}

.dstrc-chat-dialog {
    min-width: 0;
}

.dstrc-chat-dialog-head {
    min-height: 54px;
    padding: 8px 12px;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: 8px;
}

.dstrc-chat-dialog-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    font-size: 12px;
}

.dstrc-chat-dialog-person {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
}

.dstrc-chat-dialog-person h2 {
    max-width: 44vw;
    font-size: calc(var(--dstrc-chat-font-size) + 1px);
}

.dstrc-chat-dialog-person p {
    min-width: 0;
    margin: 0;
    font-size: calc(var(--dstrc-chat-font-size) - 3px);
}

.dstrc-chat-dialog-compact-meta {
    padding: 4px 8px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 18%, var(--dstrc-chat-border) 82%);
    border-radius: 999px;
    color: var(--dstrc-chat-muted);
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
}

.dstrc-chat-settings-rail {
    display: flex;
    min-width: 0;
    min-height: 0;
    border-left: 1px solid var(--dstrc-chat-border);
    background: color-mix(in srgb, var(--dstrc-chat-sidebar-bg) 88%, var(--dstrc-chat-bg) 12%);
    overflow: hidden;
}

.dstrc-chat-rail-scroll {
    display: flex;
    width: 100%;
    min-height: 0;
    max-height: 100%;
    flex-direction: column;
    gap: 9px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 10px 8px;
    scrollbar-width: thin;
}

.dstrc-chat-rail-section {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 8px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 82%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 76%, transparent);
    box-shadow: var(--dstrc-chat-inset);
}

.dstrc-chat-rail-section > strong,
.dstrc-chat-rail-section > label {
    color: var(--dstrc-chat-muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.dstrc-chat-rail-size {
    justify-content: center;
}

.dstrc-chat-settings-rail .dstrc-chat-size-switch {
    width: 100%;
}

.dstrc-chat-settings-rail .dstrc-chat-size-button {
    flex: 1 1 0;
    min-width: 0;
}

.dstrc-chat-font-family-select {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 10px;
    background: var(--dstrc-chat-bg);
    color: var(--dstrc-chat-text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 7px;
}

.dstrc-chat-settings-rail .dstrc-chat-font-control,
.dstrc-chat-settings-rail .dstrc-chat-sound-control {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.dstrc-chat-settings-rail .dstrc-chat-font-control input[type="range"],
.dstrc-chat-settings-rail .dstrc-chat-sound-control input[type="range"] {
    width: 100%;
}

.dstrc-chat-settings-rail .dstrc-chat-font-label,
.dstrc-chat-settings-rail .dstrc-chat-font-value,
.dstrc-chat-settings-rail .dstrc-chat-sound-value {
    text-align: center;
}

.dstrc-chat-settings-rail .dstrc-chat-sound-toggle,
.dstrc-chat-settings-rail .dstrc-chat-sound-preview {
    width: 100%;
    min-height: 32px;
}

.dstrc-chat-rail-actions {
    gap: 7px;
}

.dstrc-chat-rail-button {
    appearance: none;
    display: flex;
    width: 100%;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 22%, var(--dstrc-chat-border) 78%);
    border-radius: 11px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 86%, transparent);
    color: var(--dstrc-chat-text);
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.1;
    padding: 7px 5px;
}

.dstrc-chat-rail-button:disabled {
    cursor: not-allowed;
    opacity: .48;
}

.dstrc-chat-rail-button:hover:not(:disabled),
.dstrc-chat-rail-button:focus:not(:disabled) {
    background: color-mix(in srgb, var(--dstrc-chat-primary) 14%, var(--dstrc-chat-bg) 86%);
    outline: none;
}

.dstrc-chat-app.dstrc-chat-size-s {
    max-width: 920px;
    height: min(600px, calc(100vh - 24px));
    min-height: min(520px, calc(100vh - 24px));
    grid-template-columns: minmax(210px, 250px) minmax(0, 1fr) 110px;
}

.dstrc-chat-app.dstrc-chat-size-m {
    max-width: 1120px;
    height: min(var(--dstrc-chat-height, 680px), calc(100vh - 24px));
    min-height: min(560px, calc(100vh - 24px));
    grid-template-columns: minmax(250px, var(--dstrc-chat-sidebar-w)) minmax(0, 1fr) 128px;
}

.dstrc-chat-app.dstrc-chat-size-l {
    max-width: 1440px;
    height: min(88vh, 900px);
    min-height: min(680px, calc(100vh - 24px));
    grid-template-columns: minmax(290px, 390px) minmax(0, 1fr) 138px;
}

.dstrc-chat-size-s,
.dstrc-chat-size-m,
.dstrc-chat-size-l {
    font-size: var(--dstrc-chat-font-size) !important;
}

.dstrc-chat-size-s .dstrc-chat-dialog-head,
.dstrc-chat-size-m .dstrc-chat-dialog-head,
.dstrc-chat-size-l .dstrc-chat-dialog-head {
    min-height: 54px;
}

.dstrc-chat-message-bubble {
    overflow: visible;
}

.dstrc-chat-message-edit,
.dstrc-chat-message-delete {
    right: -34px;
    top: 4px;
    opacity: .32;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 94%, transparent);
}

.dstrc-chat-message-delete {
    top: 34px;
}

.dstrc-chat-message-bubble:hover .dstrc-chat-message-edit,
.dstrc-chat-message-bubble:focus-within .dstrc-chat-message-edit,
.dstrc-chat-message.is-editing .dstrc-chat-message-edit,
.dstrc-chat-message-bubble:hover .dstrc-chat-message-delete,
.dstrc-chat-message-bubble:focus-within .dstrc-chat-message-delete,
.dstrc-chat-message.is-editing .dstrc-chat-message-delete {
    opacity: 1;
}

.dstrc-chat-inline-edit,
.dstrc-chat-inline-schedule {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: min(420px, 62vw);
}

.dstrc-chat-inline-edit-input {
    width: 100%;
    min-height: 74px;
    resize: vertical;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 26%, var(--dstrc-chat-border) 74%);
    border-radius: 12px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 94%, transparent);
    color: var(--dstrc-chat-text);
    font-family: inherit;
    font-size: var(--dstrc-chat-font-size);
    line-height: 1.45;
    padding: 9px 10px;
    outline: none;
}

.dstrc-chat-inline-edit-input:focus,
.dstrc-chat-inline-schedule input[type="datetime-local"]:focus {
    border-color: var(--dstrc-chat-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--dstrc-chat-primary) 18%, transparent);
}

.dstrc-chat-inline-schedule label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--dstrc-chat-muted);
    font-size: calc(var(--dstrc-chat-font-size) - 2px);
    font-weight: 900;
}

.dstrc-chat-inline-schedule input[type="datetime-local"] {
    width: 100%;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 26%, var(--dstrc-chat-border) 74%);
    border-radius: 12px;
    background: var(--dstrc-chat-bg);
    color: var(--dstrc-chat-text);
    font-family: inherit;
    font-size: calc(var(--dstrc-chat-font-size) - 1px);
    padding: 8px 10px;
}

.dstrc-chat-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.dstrc-chat-inline-actions button {
    appearance: none;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 26%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 88%, transparent);
    color: var(--dstrc-chat-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: calc(var(--dstrc-chat-font-size) - 2px);
    font-weight: 900;
    padding: 7px 10px;
}

.dstrc-chat-inline-actions button:hover,
.dstrc-chat-inline-actions button:focus {
    background: color-mix(in srgb, var(--dstrc-chat-primary) 14%, var(--dstrc-chat-bg) 86%);
    outline: none;
}

.dstrc-chat-message.is-rescheduling .dstrc-chat-message-bubble,
.dstrc-chat-message.is-editing .dstrc-chat-message-bubble {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--dstrc-chat-primary) 24%, transparent), var(--dstrc-chat-soft-shadow);
}

.dstrc-chat-theme-dark .dstrc-chat-settings-rail,
.dstrc-chat-theme-dark .dstrc-chat-rail-section,
.dstrc-chat-theme-dark .dstrc-chat-font-family-select,
.dstrc-chat-theme-dark .dstrc-chat-rail-button,
.dstrc-chat-theme-dark .dstrc-chat-inline-edit-input,
.dstrc-chat-theme-dark .dstrc-chat-inline-schedule input[type="datetime-local"] {
    background: rgba(23, 28, 34, .94);
    color: #f6fbf8;
    border-color: rgba(247, 252, 249, .22);
}

html.dstrc-chat-pwa-installable .dstrc-chat-rail-button[data-dstrc-install-app] {
    border-color: var(--dstrc-chat-primary);
    color: var(--dstrc-chat-primary);
}

@media (max-height: 720px) {
    .dstrc-chat-dialog-head {
        min-height: 48px;
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .dstrc-chat-rail-scroll {
        padding-top: 7px;
        padding-bottom: 7px;
        gap: 6px;
    }

    .dstrc-chat-rail-section {
        padding: 7px;
    }
}

@media (max-width: 1100px) {
    .dstrc-chat-app,
    .dstrc-chat-app.dstrc-chat-size-s,
    .dstrc-chat-app.dstrc-chat-size-m,
    .dstrc-chat-app.dstrc-chat-size-l {
        grid-template-columns: minmax(230px, 300px) minmax(0, 1fr) 112px;
    }
}

@media (max-width: 860px) {
    .dstrc-chat-app,
    .dstrc-chat-app.dstrc-chat-size-s,
    .dstrc-chat-app.dstrc-chat-size-m,
    .dstrc-chat-app.dstrc-chat-size-l {
        grid-template-columns: 1fr;
        height: min(88vh, calc(100vh - 18px));
        min-height: 560px;
    }

    .dstrc-chat-settings-rail {
        order: 3;
        max-height: 126px;
        border-top: 1px solid var(--dstrc-chat-border);
        border-left: 0;
    }

    .dstrc-chat-rail-scroll {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .dstrc-chat-rail-section {
        min-width: 132px;
    }

    .dstrc-chat-dialog-person {
        display: block;
    }

    .dstrc-chat-dialog-person h2 {
        max-width: 72vw;
    }

    .dstrc-chat-dialog-compact-meta {
        display: none;
    }
}

/* v0.9.2 targeted frontend cleanup: no WordPress toolbar, refined composer, icon rail, themes and 3D chat surfaces. */
html.dstrc-chat-app-document,
html.dstrc-chat-popup-window {
    margin-top: 0 !important;
}

html.dstrc-chat-app-document #wpadminbar,
html.dstrc-chat-popup-window #wpadminbar,
body.dstrc-chat-popup-body #wpadminbar,
#wpadminbar:has(+ .dstrc-chat-shell) {
    display: none !important;
}

.dstrc-chat-shell {
    width: 100%;
}

.dstrc-chat-app {
    --dstrc-chat-raised: 6px 6px 15px rgba(84, 103, 126, .16), -5px -5px 12px rgba(255, 255, 255, .72);
    --dstrc-chat-pressed: inset 4px 4px 10px rgba(80, 96, 118, .16), inset -4px -4px 10px rgba(255, 255, 255, .78);
    --dstrc-chat-ring: 0 0 0 3px color-mix(in srgb, var(--dstrc-chat-primary) 18%, transparent);
    grid-template-columns: minmax(260px, var(--dstrc-chat-sidebar-w)) minmax(0, 1fr) 76px;
    background:
        linear-gradient(145deg, color-mix(in srgb, var(--dstrc-chat-bg) 94%, #f4f8ff 6%), var(--dstrc-chat-bg));
}

.dstrc-chat-theme-dark.dstrc-chat-app,
.dstrc-chat-theme-dark.dstrc-chat-login-shell {
    --dstrc-chat-raised: 7px 7px 18px rgba(0, 0, 0, .34), -4px -4px 12px rgba(80, 102, 132, .08);
    --dstrc-chat-pressed: inset 4px 4px 10px rgba(0, 0, 0, .38), inset -4px -4px 10px rgba(87, 108, 138, .08);
    --dstrc-chat-ring: 0 0 0 3px color-mix(in srgb, var(--dstrc-chat-primary) 30%, transparent);
    --dstrc-chat-bg: #111827;
    --dstrc-chat-panel-bg: #0f1724;
    --dstrc-chat-sidebar-bg: #151e2d;
    --dstrc-chat-header-bg: #111b2a;
    --dstrc-chat-incoming-bg: #183447;
    --dstrc-chat-outgoing-bg: #2a254a;
    --dstrc-chat-incoming-border: #4fd1c5;
    --dstrc-chat-outgoing-border: #a78bfa;
    --dstrc-chat-text: #edf7ff;
    --dstrc-chat-muted: #a9bbcf;
    --dstrc-chat-border: #2d3c52;
}

.dstrc-chat-sidebar,
.dstrc-chat-settings-rail,
.dstrc-chat-dialog-head,
.dstrc-chat-composer {
    color: var(--dstrc-chat-text);
}

.dstrc-chat-current-user,
.dstrc-chat-search,
.dstrc-chat-input,
.dstrc-chat-login-field input[type="text"],
.dstrc-chat-login-field input[type="password"],
.dstrc-chat-inline-edit-input,
.dstrc-chat-inline-schedule input[type="datetime-local"] {
    box-shadow: var(--dstrc-chat-pressed) !important;
}

.dstrc-chat-icon-button,
.dstrc-chat-send-button,
.dstrc-chat-logout-button,
.dstrc-chat-size-button,
.dstrc-chat-rail-icon-button,
.dstrc-chat-rail-mini-button,
.dstrc-chat-font-option,
.dstrc-chat-sound-option,
.dstrc-chat-inline-actions button,
.dstrc-chat-schedule-apply,
.dstrc-chat-schedule-clear {
    box-shadow: var(--dstrc-chat-raised);
    transform: translate(-1px, -1px);
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}

.dstrc-chat-icon-button:active,
.dstrc-chat-send-button:active,
.dstrc-chat-logout-button:active,
.dstrc-chat-size-button:active,
.dstrc-chat-rail-icon-button:active,
.dstrc-chat-rail-mini-button:active,
.dstrc-chat-font-option:active,
.dstrc-chat-sound-option:active,
.dstrc-chat-inline-actions button:active {
    box-shadow: var(--dstrc-chat-pressed);
    transform: translate(0, 0);
}

.dstrc-chat-dialog-head {
    min-height: 48px !important;
    padding: 7px 14px !important;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
}

.dstrc-chat-dialog-avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
}

.dstrc-chat-dialog-person h2 {
    font-size: 15px;
}

.dstrc-chat-dialog-person p {
    max-width: 100%;
    font-size: 11px;
}

.dstrc-chat-messages {
    background:
        radial-gradient(circle at 16% 12%, color-mix(in srgb, var(--dstrc-chat-primary) 8%, transparent), transparent 26%),
        linear-gradient(180deg, color-mix(in srgb, var(--dstrc-chat-panel-bg) 94%, #ffffff 6%), var(--dstrc-chat-panel-bg));
    padding: 18px 22px;
}

.dstrc-chat-theme-dark .dstrc-chat-messages {
    background:
        radial-gradient(circle at 12% 10%, rgba(79, 209, 197, .10), transparent 28%),
        linear-gradient(180deg, #101927, #0d1420);
}

.dstrc-chat-message {
    max-width: min(82%, 720px);
}

.dstrc-chat-align-all-left .dstrc-chat-message.is-own {
    margin-left: clamp(28px, 5.5vw, 70px);
}

.dstrc-chat-message-bubble {
    border-width: 1px 1px 1px 5px !important;
    box-shadow: 0 10px 24px rgba(62, 82, 104, .10), inset 0 1px 0 rgba(255,255,255,.68);
    padding: 11px 14px 8px;
}

.dstrc-chat-message.is-incoming .dstrc-chat-message-bubble {
    background: linear-gradient(145deg, color-mix(in srgb, var(--dstrc-chat-incoming-bg) 94%, #ffffff 6%), var(--dstrc-chat-incoming-bg)) !important;
    border-color: color-mix(in srgb, var(--dstrc-chat-incoming-border) 70%, var(--dstrc-chat-border) 30%) !important;
    border-left-color: var(--dstrc-chat-incoming-border) !important;
}

.dstrc-chat-message.is-own .dstrc-chat-message-bubble {
    background: linear-gradient(145deg, color-mix(in srgb, var(--dstrc-chat-outgoing-bg) 92%, #ffffff 8%), var(--dstrc-chat-outgoing-bg)) !important;
    border-color: color-mix(in srgb, var(--dstrc-chat-outgoing-border) 72%, var(--dstrc-chat-border) 28%) !important;
    border-left-color: var(--dstrc-chat-outgoing-border) !important;
}

.dstrc-chat-theme-dark .dstrc-chat-message-bubble {
    box-shadow: 0 10px 28px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.08);
}

.dstrc-chat-message-sender {
    font-size: 11px;
    letter-spacing: .01em;
}

.dstrc-chat-message-meta {
    opacity: .86;
}

.dstrc-chat-composer {
    background: color-mix(in srgb, var(--dstrc-chat-header-bg) 92%, var(--dstrc-chat-bg) 8%);
}

.dstrc-chat-composer-main {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
    padding: 12px 16px 13px;
}

.dstrc-chat-composer-input-row {
    display: block;
    width: 100%;
}

.dstrc-chat-composer-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
}

.dstrc-chat-composer-actions .dstrc-chat-send-button {
    margin-left: auto;
}

.dstrc-chat-input {
    width: 100%;
    min-height: 48px;
    max-height: min(34vh, 220px);
    resize: vertical;
    border-radius: 20px;
    padding: 13px 16px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 96%, #ffffff 4%);
}

.dstrc-chat-input:focus {
    box-shadow: var(--dstrc-chat-ring), var(--dstrc-chat-pressed) !important;
}

.dstrc-chat-icon-button {
    width: 42px;
    height: 42px;
    border-radius: 15px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 88%, var(--dstrc-chat-primary) 12%);
}

.dstrc-chat-send-button {
    min-width: 132px;
    min-height: 43px;
    border-radius: 18px;
}

.dstrc-chat-settings-rail {
    width: 76px;
    min-width: 76px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--dstrc-chat-sidebar-bg) 88%, var(--dstrc-chat-bg) 12%), var(--dstrc-chat-sidebar-bg));
}

.dstrc-chat-rail-scroll {
    align-items: center;
    gap: 10px;
    padding: 10px 7px;
}

.dstrc-chat-rail-section,
.dstrc-chat-rail-icon-section {
    width: 60px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 5px;
    border-radius: 18px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 82%, transparent);
    box-shadow: var(--dstrc-chat-pressed);
}

.dstrc-chat-rail-section > strong,
.dstrc-chat-rail-section > label {
    display: none !important;
}

.dstrc-chat-rail-icon,
.dstrc-chat-rail-icon-button,
.dstrc-chat-rail-mini-button,
.dstrc-chat-sound-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.dstrc-chat-rail-icon {
    width: 38px;
    min-height: 28px;
    color: var(--dstrc-chat-muted);
    font-size: 17px;
    font-weight: 900;
}

.dstrc-chat-rail-icon-aa {
    font-size: 13px;
    letter-spacing: -.04em;
}

.dstrc-chat-rail-icon-button,
.dstrc-chat-rail-mini-button,
.dstrc-chat-sound-toggle {
    appearance: none;
    width: 44px;
    min-width: 44px;
    height: 40px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 18%, var(--dstrc-chat-border) 82%);
    border-radius: 15px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 88%, var(--dstrc-chat-primary) 12%);
    color: var(--dstrc-chat-text);
    cursor: pointer;
    font-family: inherit;
    font-size: 17px;
    font-weight: 900;
    padding: 0;
}

.dstrc-chat-rail-icon-button:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.dstrc-chat-size-switch.dstrc-chat-rail-size {
    display: flex;
    width: 42px !important;
    flex-direction: column;
    gap: 5px;
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.dstrc-chat-settings-rail .dstrc-chat-size-button {
    width: 42px;
    height: 32px;
    flex: 0 0 auto;
    border: 1px solid transparent;
    border-radius: 13px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 88%, transparent);
}

.dstrc-chat-settings-rail .dstrc-chat-size-button.is-active,
.dstrc-chat-settings-rail .dstrc-chat-size-button[aria-pressed="true"] {
    border-color: color-mix(in srgb, var(--dstrc-chat-primary) 28%, var(--dstrc-chat-border) 72%);
    background: color-mix(in srgb, var(--dstrc-chat-primary) 18%, var(--dstrc-chat-bg) 82%);
}

.dstrc-chat-vertical-range {
    width: 92px !important;
    height: 24px;
    transform: rotate(-90deg);
    transform-origin: center;
    accent-color: var(--dstrc-chat-primary);
    margin: 30px -29px;
}

.dstrc-chat-rail-value {
    display: block;
    min-width: 46px;
    color: var(--dstrc-chat-muted);
    font-size: 11px;
    font-weight: 900;
    text-align: center;
}

.dstrc-chat-rail-actions {
    width: 60px;
    gap: 8px;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.dstrc-chat-rail-modal {
    position: absolute;
    top: 12px;
    right: 82px;
    z-index: 50;
    width: min(320px, calc(100vw - 118px));
}

.dstrc-chat-rail-modal[hidden] {
    display: none !important;
}

.dstrc-chat-rail-modal-card {
    position: relative;
    display: grid;
    gap: 12px;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 22px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 96%, #ffffff 4%);
    color: var(--dstrc-chat-text);
    box-shadow: 0 22px 58px rgba(15, 23, 42, .20);
    padding: 15px;
}

.dstrc-chat-rail-modal-card strong {
    padding-right: 30px;
}

.dstrc-chat-rail-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 10px;
    background: var(--dstrc-chat-bg);
    color: var(--dstrc-chat-text);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.dstrc-chat-font-options,
.dstrc-chat-sound-options {
    display: grid;
    gap: 8px;
}

.dstrc-chat-font-option,
.dstrc-chat-sound-option {
    appearance: none;
    display: flex;
    width: 100%;
    min-height: 40px;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 90%, transparent);
    color: var(--dstrc-chat-text);
    cursor: pointer;
    font-size: 14px;
    font-weight: 850;
    padding: 8px 11px;
    text-align: left;
}

.dstrc-chat-font-option.is-active,
.dstrc-chat-sound-option.is-active {
    border-color: color-mix(in srgb, var(--dstrc-chat-primary) 48%, var(--dstrc-chat-border) 52%);
    background: color-mix(in srgb, var(--dstrc-chat-primary) 18%, var(--dstrc-chat-bg) 82%);
    color: var(--dstrc-chat-primary);
}

.dstrc-chat-theme-dark .dstrc-chat-rail-modal-card,
.dstrc-chat-theme-dark .dstrc-chat-font-option,
.dstrc-chat-theme-dark .dstrc-chat-sound-option,
.dstrc-chat-theme-dark .dstrc-chat-rail-modal-close,
.dstrc-chat-theme-dark .dstrc-chat-icon-button,
.dstrc-chat-theme-dark .dstrc-chat-rail-icon-button,
.dstrc-chat-theme-dark .dstrc-chat-rail-mini-button,
.dstrc-chat-theme-dark .dstrc-chat-sound-toggle,
.dstrc-chat-theme-dark .dstrc-chat-input {
    background: color-mix(in srgb, var(--dstrc-chat-bg) 88%, #253247 12%);
    color: var(--dstrc-chat-text);
}

.dstrc-chat-theme-dark .dstrc-chat-message.is-incoming .dstrc-chat-message-bubble {
    background: linear-gradient(145deg, #1a3b4c, #152d40) !important;
}

.dstrc-chat-theme-dark .dstrc-chat-message.is-own .dstrc-chat-message-bubble {
    background: linear-gradient(145deg, #332a5d, #251f47) !important;
}

.dstrc-chat-theme-dark .dstrc-chat-send-button {
    color: #fff;
}

.dstrc-chat-app.dstrc-chat-size-s {
    max-width: 980px;
    height: min(620px, calc(100dvh - 18px));
    min-height: min(520px, calc(100dvh - 18px));
    grid-template-columns: minmax(220px, 270px) minmax(0, 1fr) 76px;
}

.dstrc-chat-app.dstrc-chat-size-m {
    max-width: 1180px;
    height: min(var(--dstrc-chat-height, 680px), calc(100dvh - 18px));
    min-height: min(560px, calc(100dvh - 18px));
    grid-template-columns: minmax(250px, var(--dstrc-chat-sidebar-w)) minmax(0, 1fr) 76px;
}

.dstrc-chat-app.dstrc-chat-size-l {
    max-width: 1500px;
    height: min(90dvh, 940px);
    min-height: min(680px, calc(100dvh - 18px));
    grid-template-columns: minmax(290px, 390px) minmax(0, 1fr) 76px;
}

.dstrc-chat-popup-root {
    padding: 0 !important;
}

.dstrc-chat-popup-root .dstrc-chat-shell,
.dstrc-chat-popup-root .dstrc-chat-app,
.dstrc-chat-popup-body .dstrc-chat-shell,
.dstrc-chat-popup-body .dstrc-chat-app {
    min-height: 100dvh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
}

@media (max-width: 1100px) {
    .dstrc-chat-app,
    .dstrc-chat-app.dstrc-chat-size-s,
    .dstrc-chat-app.dstrc-chat-size-m,
    .dstrc-chat-app.dstrc-chat-size-l {
        grid-template-columns: minmax(220px, 300px) minmax(0, 1fr) 72px;
    }
}

@media (max-width: 860px) {
    .dstrc-chat-app,
    .dstrc-chat-app.dstrc-chat-size-s,
    .dstrc-chat-app.dstrc-chat-size-m,
    .dstrc-chat-app.dstrc-chat-size-l {
        grid-template-columns: 1fr;
    }

    .dstrc-chat-settings-rail {
        width: 100%;
        min-width: 0;
        max-height: 86px;
    }

    .dstrc-chat-rail-scroll {
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .dstrc-chat-rail-section,
    .dstrc-chat-rail-icon-section {
        min-width: 60px;
        width: 60px;
    }

    .dstrc-chat-vertical-range {
        transform: none;
        width: 86px !important;
        margin: 0;
    }

    .dstrc-chat-rail-modal {
        top: auto;
        right: 10px;
        bottom: 92px;
        width: min(320px, calc(100vw - 20px));
    }

    .dstrc-chat-composer-actions {
        flex-wrap: wrap;
    }

    .dstrc-chat-composer-actions .dstrc-chat-send-button {
        flex: 1 1 100%;
        margin-left: 0;
    }
}

.dstrc-chat-settings-rail {
    position: relative;
    overflow: visible;
}

.dstrc-chat-rail-scroll {
    overflow-x: visible;
}

@media (max-width: 860px) {
    .dstrc-chat-settings-rail {
        overflow: visible;
    }

    .dstrc-chat-rail-scroll {
        overflow-x: auto;
        overflow-y: hidden;
    }
}


/* v0.12.1 frontend layout, search, toast and navigation fixes */
.dstrc-chat-shell {
    width: 100%;
    max-height: calc(100vh - 12px);
    min-height: 0;
    overflow: hidden;
}

.dstrc-chat-app,
.dstrc-chat-app.dstrc-chat-size-s,
.dstrc-chat-app.dstrc-chat-size-m,
.dstrc-chat-app.dstrc-chat-size-l {
    height: min(var(--dstrc-chat-height, 720px), calc(100vh - 12px)) !important;
    max-height: calc(100vh - 12px) !important;
    min-height: min(540px, calc(100vh - 12px));
    overflow: hidden;
}

.dstrc-chat-dialog {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.dstrc-chat-dialog-head {
    grid-template-columns: auto auto minmax(140px, auto) minmax(240px, 1fr) auto !important;
    align-items: center;
}

.dstrc-chat-dialog-search {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) auto auto auto;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.dstrc-chat-dialog-search-input {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 96%, #fff 4%);
    color: var(--dstrc-chat-text);
    padding: 8px 12px;
    box-shadow: var(--dstrc-chat-pressed);
}

.dstrc-chat-dialog-search-input:focus {
    outline: none;
    box-shadow: var(--dstrc-chat-ring), var(--dstrc-chat-pressed);
}

.dstrc-chat-search-nav {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    font-size: 16px;
}

.dstrc-chat-dialog-search-count {
    min-width: 36px;
    text-align: center;
    color: var(--dstrc-chat-muted);
    font-size: 11px;
    font-weight: 800;
}

.dstrc-chat-messages {
    min-height: 0 !important;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
}

.dstrc-chat-composer {
    min-height: 0;
    overflow: hidden;
}

.dstrc-chat-composer-main {
    grid-template-columns: 1fr !important;
    gap: 10px;
    align-items: stretch;
}

.dstrc-chat-composer-actions {
    flex-wrap: wrap;
    align-items: center;
}

.dstrc-chat-dialog-jump-nav {
    display: inline-flex;
    margin-left: auto;
    gap: 8px;
}

.dstrc-chat-jump-button {
    width: 42px;
    height: 42px;
}

.dstrc-chat-settings-rail {
    align-self: stretch;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.dstrc-chat-rail-scroll {
    height: 100%;
    max-height: 100%;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}

.dstrc-chat-message.has-search-match .dstrc-chat-message-bubble {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--dstrc-chat-primary) 16%, transparent), 0 8px 24px rgba(62, 82, 104, .12), inset 0 1px 0 rgba(255,255,255,.68);
}

.dstrc-chat-message.is-current-search-match .dstrc-chat-message-bubble {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--dstrc-chat-primary) 48%, transparent), 0 14px 26px rgba(62, 82, 104, .18), inset 0 1px 0 rgba(255,255,255,.76);
}

.dstrc-chat-toast-stack {
    position: fixed;
    top: 14px;
    right: 18px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.dstrc-chat-toast {
    min-width: 220px;
    max-width: min(92vw, 420px);
    padding: 11px 14px;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 22%, var(--dstrc-chat-border) 78%);
    background: color-mix(in srgb, var(--dstrc-chat-bg) 92%, #fff 8%);
    color: var(--dstrc-chat-text);
    box-shadow: 0 14px 30px rgba(15, 23, 42, .22);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .18s ease, transform .18s ease;
}

.dstrc-chat-toast.is-visible { opacity: 1; transform: translateY(0); }
.dstrc-chat-toast.is-error { border-color: rgba(220, 38, 38, .35); }
.dstrc-chat-toast.is-success { border-color: rgba(16, 185, 129, .35); }

@media (max-width: 1100px) {
    .dstrc-chat-dialog-head {
        grid-template-columns: auto auto minmax(110px, auto) minmax(180px, 1fr) auto !important;
    }
}

@media (max-width: 860px) {
    .dstrc-chat-app,
    .dstrc-chat-app.dstrc-chat-size-s,
    .dstrc-chat-app.dstrc-chat-size-m,
    .dstrc-chat-app.dstrc-chat-size-l {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
        min-height: min(560px, calc(100vh - 12px));
    }
    .dstrc-chat-dialog-head {
        grid-template-columns: auto auto minmax(0, 1fr) auto !important;
    }
    .dstrc-chat-dialog-search {
        grid-column: 1 / -1;
        order: 5;
    }
    .dstrc-chat-settings-rail {
        order: 3;
        max-height: 122px;
    }
}

/* v0.12.2 clean compact dialog header and neon online indicators */
.dstrc-chat-dialog-head {
    grid-template-columns: auto auto minmax(90px, max-content) minmax(220px, 1fr) !important;
    min-height: 48px !important;
    gap: 8px !important;
    padding: 7px 12px !important;
}

.dstrc-chat-dialog-compact-meta {
    display: none !important;
}

.dstrc-chat-dialog-person {
    min-width: 0;
    max-width: 220px;
}

.dstrc-chat-dialog-person h2 {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    line-height: 1.15;
}

.dstrc-chat-dialog-person p,
.dstrc-chat-hide-presence .dstrc-chat-dialog-person p {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.dstrc-chat-dialog-search {
    justify-self: stretch;
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 38px 38px 38px auto;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.dstrc-chat-dialog-search-input {
    height: 38px;
    min-height: 38px;
    border-radius: 999px;
    padding: 8px 14px;
}

.dstrc-chat-search-run,
.dstrc-chat-search-nav {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px;
    border-radius: 14px !important;
    font-size: 16px !important;
}

.dstrc-chat-dialog-search-count {
    min-width: 34px;
    font-size: 10px;
    font-weight: 900;
    color: var(--dstrc-chat-muted);
}

.dstrc-chat-avatar {
    position: relative;
}

.dstrc-chat-presence-dot {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 11px;
    height: 11px;
    border: 2px solid color-mix(in srgb, var(--dstrc-chat-bg) 92%, #fff 8%);
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, .16), 0 0 10px rgba(239, 68, 68, .95), 0 0 18px rgba(239, 68, 68, .45);
    pointer-events: auto;
}

.dstrc-chat-avatar.is-online .dstrc-chat-presence-dot {
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, .16), 0 0 10px rgba(34, 197, 94, .95), 0 0 18px rgba(34, 197, 94, .48);
}

.dstrc-chat-avatar.is-offline .dstrc-chat-presence-dot {
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, .16), 0 0 10px rgba(239, 68, 68, .95), 0 0 18px rgba(239, 68, 68, .45);
}

.dstrc-chat-dialog-avatar .dstrc-chat-presence-dot {
    width: 12px;
    height: 12px;
    right: -2px;
    bottom: -2px;
}

.dstrc-chat-contact .dstrc-chat-avatar .dstrc-chat-presence-dot {
    width: 10px;
    height: 10px;
}

@media (max-width: 1100px) {
    .dstrc-chat-dialog-head {
        grid-template-columns: auto auto minmax(70px, max-content) minmax(160px, 1fr) !important;
    }
    .dstrc-chat-dialog-person {
        max-width: 150px;
    }
    .dstrc-chat-dialog-person h2 {
        max-width: 150px;
    }
}

@media (max-width: 860px) {
    .dstrc-chat-dialog-head {
        grid-template-columns: auto auto minmax(0, 1fr) !important;
    }
    .dstrc-chat-dialog-search {
        grid-column: 1 / -1;
        grid-template-columns: minmax(120px, 1fr) 38px 38px 38px auto;
        order: 5;
    }
    .dstrc-chat-dialog-person,
    .dstrc-chat-dialog-person h2 {
        max-width: 58vw;
    }
}


/* v0.12.2 final header cleanup: no visible text labels, no MSK pill, compact search, guaranteed hidden screen-reader labels. */
.dstrc-chat-dialog-head .screen-reader-text,
.dstrc-chat-dialog-search > label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.dstrc-chat-dialog-head {
    grid-template-columns: auto auto minmax(90px, max-content) minmax(220px, 1fr) !important;
}

.dstrc-chat-dialog-person p,
.dstrc-chat-dialog-compact-meta {
    display: none !important;
}

.dstrc-chat-dialog-search-input::placeholder {
    color: transparent !important;
}

.dstrc-chat-dialog-search-input {
    border-radius: 999px !important;
}

@media (max-width: 860px) {
    .dstrc-chat-dialog-head {
        grid-template-columns: auto auto minmax(0, 1fr) !important;
    }
    .dstrc-chat-dialog-search {
        grid-column: 1 / -1;
        grid-template-columns: minmax(120px, 1fr) 38px 38px 38px auto;
    }
}


/* v0.12.3 header search width and inside-avatar presence dots */
.dstrc-chat-dialog-head {
    grid-template-columns: auto auto minmax(72px, 160px) minmax(280px, 560px) !important;
}

.dstrc-chat-dialog-person h2 {
    max-width: 160px;
}

.dstrc-chat-dialog-search {
    width: clamp(280px, 42vw, 560px);
    max-width: 100%;
    justify-self: stretch;
    grid-template-columns: minmax(190px, 1fr) 38px 38px 38px auto;
}

.dstrc-chat-dialog-search-input {
    min-width: 190px;
}

.dstrc-chat-presence-dot {
    right: 4px !important;
    bottom: 4px !important;
    width: 9px !important;
    height: 9px !important;
    box-sizing: border-box;
    border-width: 1.5px !important;
}

.dstrc-chat-dialog-avatar .dstrc-chat-presence-dot {
    right: 5px !important;
    bottom: 5px !important;
    width: 10px !important;
    height: 10px !important;
}

.dstrc-chat-contact .dstrc-chat-avatar .dstrc-chat-presence-dot,
.dstrc-chat-avatar-small .dstrc-chat-presence-dot {
    right: 4px !important;
    bottom: 4px !important;
    width: 8px !important;
    height: 8px !important;
}

@media (max-width: 1100px) {
    .dstrc-chat-dialog-head {
        grid-template-columns: auto auto minmax(64px, 130px) minmax(230px, 1fr) !important;
    }
    .dstrc-chat-dialog-search {
        width: clamp(230px, 40vw, 460px);
        grid-template-columns: minmax(150px, 1fr) 36px 36px 36px auto;
    }
}

@media (max-width: 860px) {
    .dstrc-chat-dialog-search {
        width: 100%;
        grid-template-columns: minmax(160px, 1fr) 36px 36px 36px auto;
    }
    .dstrc-chat-dialog-person h2 {
        max-width: 42vw;
    }
}


/* v0.12.4 — make header search use available width and keep presence dots inside avatars */
@media (min-width: 861px) {
    .dstrc-chat-dialog-head {
        grid-template-columns: auto minmax(72px, max-content) minmax(0, 1fr) !important;
    }

    .dstrc-chat-dialog-head .dstrc-chat-mobile-back {
        display: none !important;
    }

    .dstrc-chat-dialog-avatar {
        grid-column: 1;
    }

    .dstrc-chat-dialog-person {
        grid-column: 2;
        max-width: 190px !important;
        min-width: 72px;
    }

    .dstrc-chat-dialog-person h2 {
        max-width: 190px !important;
    }

    .dstrc-chat-dialog-search {
        grid-column: 3;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        justify-self: stretch !important;
        grid-template-columns: minmax(320px, 1fr) 38px 38px 38px auto !important;
    }

    .dstrc-chat-dialog-search-input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }
}

@media (min-width: 1200px) {
    .dstrc-chat-dialog-person {
        max-width: 220px !important;
    }

    .dstrc-chat-dialog-person h2 {
        max-width: 220px !important;
    }

    .dstrc-chat-dialog-search {
        grid-template-columns: minmax(420px, 1fr) 38px 38px 38px auto !important;
    }
}

.dstrc-chat-avatar {
    overflow: hidden;
}

.dstrc-chat-presence-dot,
.dstrc-chat-dialog-avatar .dstrc-chat-presence-dot,
.dstrc-chat-contact .dstrc-chat-avatar .dstrc-chat-presence-dot,
.dstrc-chat-avatar-small .dstrc-chat-presence-dot {
    right: 5px !important;
    bottom: 5px !important;
    transform: none !important;
    z-index: 2;
}

.dstrc-chat-dialog-avatar .dstrc-chat-presence-dot {
    right: 6px !important;
    bottom: 6px !important;
}

.dstrc-chat-contact .dstrc-chat-avatar .dstrc-chat-presence-dot,
.dstrc-chat-avatar-small .dstrc-chat-presence-dot {
    right: 5px !important;
    bottom: 5px !important;
}

@media (max-width: 860px) {
    .dstrc-chat-dialog-head {
        grid-template-columns: auto auto minmax(0, 1fr) !important;
    }

    .dstrc-chat-dialog-search {
        grid-column: 1 / -1;
        width: 100% !important;
        max-width: none !important;
        grid-template-columns: minmax(0, 1fr) 36px 36px 36px auto !important;
    }

    .dstrc-chat-dialog-search-input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }
}


/* v0.12.5 — stable header search sizing and avatar status dots */
@media (min-width: 861px) {
    .dstrc-chat-dialog-head {
        grid-template-columns: auto minmax(74px, max-content) minmax(0, 1fr) !important;
    }

    .dstrc-chat-dialog-search {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        justify-self: stretch !important;
        grid-template-columns: minmax(0, 1fr) 38px 38px 38px minmax(0, auto) !important;
    }

    .dstrc-chat-dialog-search-input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    .dstrc-chat-size-s .dstrc-chat-dialog-head {
        grid-template-columns: auto minmax(58px, 120px) minmax(0, 1fr) !important;
        gap: 6px !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .dstrc-chat-size-s .dstrc-chat-dialog-person {
        max-width: 120px !important;
        min-width: 58px !important;
    }

    .dstrc-chat-size-s .dstrc-chat-dialog-person h2 {
        max-width: 120px !important;
    }

    .dstrc-chat-size-s .dstrc-chat-dialog-search {
        grid-template-columns: minmax(0, 1fr) 34px 34px 34px minmax(0, auto) !important;
        gap: 5px !important;
    }

    .dstrc-chat-size-s .dstrc-chat-search-nav,
    .dstrc-chat-size-s .dstrc-chat-dialog-search .dstrc-chat-head-button {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
    }

    .dstrc-chat-size-s .dstrc-chat-dialog-search-count {
        display: none !important;
    }
}

.dstrc-chat-avatar {
    position: relative;
    overflow: hidden !important;
}

.dstrc-chat-presence-dot,
.dstrc-chat-dialog-avatar .dstrc-chat-presence-dot,
.dstrc-chat-contact .dstrc-chat-avatar .dstrc-chat-presence-dot,
.dstrc-chat-avatar-small .dstrc-chat-presence-dot {
    position: absolute !important;
    right: 4px !important;
    bottom: 4px !important;
    width: 9px !important;
    height: 9px !important;
    min-width: 9px !important;
    border-width: 2px !important;
    transform: none !important;
    z-index: 3 !important;
}

.dstrc-chat-dialog-avatar .dstrc-chat-presence-dot {
    right: 5px !important;
    bottom: 5px !important;
    width: 10px !important;
    height: 10px !important;
    min-width: 10px !important;
}

/* v0.12.5 final override — S/M/L search must never push arrows out */
.dstrc-chat-dialog-search-count {
    display: none !important;
}

@media (min-width: 861px) {
    .dstrc-chat-app .dstrc-chat-dialog-head,
    .dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-dialog-head,
    .dstrc-chat-app.dstrc-chat-size-m .dstrc-chat-dialog-head,
    .dstrc-chat-app.dstrc-chat-size-l .dstrc-chat-dialog-head {
        grid-template-columns: auto minmax(48px, max-content) minmax(0, 1fr) !important;
        overflow: hidden;
    }

    .dstrc-chat-app .dstrc-chat-dialog-person,
    .dstrc-chat-app .dstrc-chat-dialog-person h2 {
        min-width: 48px !important;
        max-width: clamp(72px, 12vw, 180px) !important;
    }

    .dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-dialog-person,
    .dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-dialog-person h2 {
        max-width: 92px !important;
    }

    .dstrc-chat-app .dstrc-chat-dialog-search,
    .dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-dialog-search,
    .dstrc-chat-app.dstrc-chat-size-m .dstrc-chat-dialog-search,
    .dstrc-chat-app.dstrc-chat-size-l .dstrc-chat-dialog-search {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        justify-self: stretch !important;
        grid-template-columns: minmax(0, 1fr) 38px 38px 38px !important;
        overflow: hidden;
    }

    .dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-dialog-search {
        grid-template-columns: minmax(0, 1fr) 32px 32px 32px !important;
        gap: 4px !important;
    }

    .dstrc-chat-app .dstrc-chat-dialog-search-input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    .dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-search-nav,
    .dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-dialog-search .dstrc-chat-head-button {
        width: 32px !important;
        min-width: 32px !important;
        height: 32px !important;
    }
}


/* v0.12.5 — compact adaptive header search for S/M sizes */
.dstrc-chat-dialog-head,
.dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-dialog-head,
.dstrc-chat-app.dstrc-chat-size-m .dstrc-chat-dialog-head,
.dstrc-chat-app.dstrc-chat-size-l .dstrc-chat-dialog-head {
    overflow: hidden;
}

@media (min-width: 861px) {
    .dstrc-chat-dialog-search {
        min-width: 0 !important;
        width: auto !important;
        grid-template-columns: minmax(0, 1fr) 38px 38px 38px minmax(0, auto) !important;
    }

    .dstrc-chat-dialog-search-input {
        min-width: 0 !important;
    }

    .dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-dialog-head {
        grid-template-columns: auto minmax(54px, 126px) minmax(0, 1fr) !important;
        gap: 6px !important;
        padding-left: 9px !important;
        padding-right: 9px !important;
    }

    .dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-dialog-person,
    .dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-dialog-person h2 {
        max-width: 126px !important;
        min-width: 54px !important;
    }

    .dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-dialog-search {
        grid-template-columns: minmax(0, 1fr) 32px 32px 32px !important;
        gap: 5px !important;
        min-width: 0 !important;
    }

    .dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-search-nav,
    .dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-dialog-search .dstrc-chat-head-button {
        width: 32px !important;
        min-width: 32px !important;
        height: 32px !important;
        border-radius: 11px !important;
        font-size: 14px !important;
    }

    .dstrc-chat-app.dstrc-chat-size-s .dstrc-chat-dialog-search-count {
        display: none !important;
    }

    .dstrc-chat-app.dstrc-chat-size-m .dstrc-chat-dialog-search {
        grid-template-columns: minmax(0, 1fr) 36px 36px 36px minmax(0, auto) !important;
    }
}

@media (max-width: 1120px) and (min-width: 861px) {
    .dstrc-chat-dialog-head {
        grid-template-columns: auto minmax(54px, 148px) minmax(0, 1fr) !important;
        gap: 7px !important;
    }

    .dstrc-chat-dialog-person,
    .dstrc-chat-dialog-person h2 {
        max-width: 148px !important;
        min-width: 54px !important;
    }

    .dstrc-chat-dialog-search {
        grid-template-columns: minmax(0, 1fr) 34px 34px 34px !important;
        gap: 6px !important;
    }

    .dstrc-chat-dialog-search-count {
        display: none !important;
    }
}


/* v0.12.5 — final adaptive search header for S/M/L and retention UI fix release */
@media (min-width: 861px) {
    .dstrc-chat-dialog-head {
        grid-template-columns: auto minmax(48px, max-content) minmax(0, 1fr) !important;
        column-gap: 8px !important;
        overflow: hidden;
    }

    .dstrc-chat-dialog-person {
        min-width: 48px !important;
        max-width: clamp(76px, 12vw, 190px) !important;
    }

    .dstrc-chat-dialog-person h2 {
        max-width: clamp(76px, 12vw, 190px) !important;
    }

    .dstrc-chat-dialog-search {
        grid-column: 3 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        justify-self: stretch !important;
        grid-template-columns: minmax(0, 1fr) 38px 38px 38px auto !important;
        overflow: hidden;
    }

    .dstrc-chat-dialog-search-input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }
}

.dstrc-chat-size-s .dstrc-chat-dialog-head {
    grid-template-columns: auto minmax(38px, 116px) minmax(0, 1fr) !important;
    column-gap: 6px !important;
}

.dstrc-chat-size-s .dstrc-chat-dialog-avatar {
    width: 32px !important;
    height: 32px !important;
    flex-basis: 32px !important;
    min-width: 32px !important;
}

.dstrc-chat-size-s .dstrc-chat-dialog-person {
    min-width: 38px !important;
    max-width: 116px !important;
}

.dstrc-chat-size-s .dstrc-chat-dialog-person h2 {
    max-width: 116px !important;
    font-size: 13px !important;
}

.dstrc-chat-size-s .dstrc-chat-dialog-search {
    grid-template-columns: minmax(0, 1fr) 34px 34px 34px !important;
    gap: 5px !important;
}

.dstrc-chat-size-s .dstrc-chat-dialog-search-count {
    display: none !important;
}

.dstrc-chat-size-s .dstrc-chat-search-run,
.dstrc-chat-size-s .dstrc-chat-search-nav {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    border-radius: 12px !important;
}

@media (max-width: 1180px) and (min-width: 861px) {
    .dstrc-chat-dialog-head {
        grid-template-columns: auto minmax(48px, 150px) minmax(0, 1fr) !important;
    }

    .dstrc-chat-dialog-person,
    .dstrc-chat-dialog-person h2 {
        max-width: 150px !important;
    }

    .dstrc-chat-dialog-search {
        grid-template-columns: minmax(0, 1fr) 36px 36px 36px !important;
        gap: 6px !important;
    }

    .dstrc-chat-dialog-search-count {
        display: none !important;
    }

    .dstrc-chat-search-run,
    .dstrc-chat-search-nav {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
    }
}

/* v0.14.0 mobile/web hardening and composer stability */
.dstrc-chat-app {
    contain: layout style;
}

.dstrc-chat-dialog,
.dstrc-chat-sidebar,
.dstrc-chat-settings-rail {
    min-height: 0;
}

.dstrc-chat-messages {
    overflow-y: auto !important;
    overscroll-behavior: contain;
}

.dstrc-chat-send-button[disabled],
.dstrc-chat-icon-button[disabled] {
    pointer-events: none;
}

@media (max-width: 680px) {
    .dstrc-chat-shell {
        max-height: 100vh;
    }

    .dstrc-chat-app,
    .dstrc-chat-app.dstrc-chat-size-s,
    .dstrc-chat-app.dstrc-chat-size-m,
    .dstrc-chat-app.dstrc-chat-size-l {
        width: 100%;
        height: 100dvh !important;
        max-height: 100dvh !important;
        min-height: 0 !important;
        border-radius: 0;
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .dstrc-chat-dialog-head {
        min-height: 50px !important;
        padding: 7px 9px !important;
        gap: 7px;
    }

    .dstrc-chat-dialog-search {
        grid-template-columns: minmax(0, 1fr) 34px 34px 34px;
        width: 100%;
    }

    .dstrc-chat-dialog-search-input {
        min-width: 0;
    }

    .dstrc-chat-composer-main {
        padding: 9px 10px 10px;
    }

    .dstrc-chat-composer-actions {
        gap: 7px;
    }

    .dstrc-chat-send-button {
        min-width: 104px;
    }

    .dstrc-chat-dialog-jump-nav {
        margin-left: 0;
    }

    .dstrc-chat-settings-rail {
        max-height: 104px;
    }
}

/* v0.14.0 mobile-web stability hardening */
@media (max-width: 640px) {
    .dstrc-chat-shell {
        max-height: 100dvh;
    }
    .dstrc-chat-app,
    .dstrc-chat-app.dstrc-chat-size-s,
    .dstrc-chat-app.dstrc-chat-size-m,
    .dstrc-chat-app.dstrc-chat-size-l {
        width: 100%;
        max-width: 100%;
        height: 100dvh !important;
        max-height: 100dvh !important;
        min-height: 0;
        border-radius: 0;
    }
    .dstrc-chat-sidebar,
    .dstrc-chat-dialog {
        min-height: 0;
    }
    .dstrc-chat-messages {
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .dstrc-chat-composer {
        flex-shrink: 0;
    }
    .dstrc-chat-input {
        max-height: 32dvh;
    }
    .dstrc-chat-dialog-search {
        min-width: 0;
    }
    .dstrc-chat-dialog-search-input {
        min-width: 0;
    }
}


/* v1.0.1 — fix font/sound picker popups clipped by the right settings rail. */
.dstrc-chat-rail-modal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto !important;
    max-width: none !important;
    padding: 18px;
    background: rgba(15, 23, 42, .34);
    backdrop-filter: blur(4px);
}

.dstrc-chat-rail-modal[hidden] {
    display: none !important;
}

.dstrc-chat-rail-modal-card {
    width: min(380px, calc(100vw - 34px));
    max-height: min(82vh, 620px);
    overflow: auto;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .34), var(--dstrc-chat-raised);
}

.dstrc-chat-font-options,
.dstrc-chat-sound-options {
    max-height: min(62vh, 420px);
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: thin;
}

.dstrc-chat-theme-dark .dstrc-chat-rail-modal {
    background: rgba(0, 0, 0, .54);
}

@media (max-width: 520px) {
    .dstrc-chat-rail-modal {
        padding: 12px;
        align-items: flex-end;
    }

    .dstrc-chat-rail-modal-card {
        width: 100%;
        max-height: 78vh;
        border-radius: 20px 20px 14px 14px;
    }
}

/* v1.0.5: emoji picker must be above composer/messages, never clipped by chat panels. */
.dstrc-chat-emoji-panel {
    position: fixed !important;
    z-index: 2147483000 !important;
    width: min(420px, calc(100vw - 24px)) !important;
    max-height: min(420px, calc(100vh - 130px)) !important;
    overflow: hidden !important;
    border-radius: 20px !important;
}
.dstrc-chat-emoji-grid {
    max-height: min(360px, calc(100vh - 190px)) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: thin;
}
.dstrc-chat-emoji-item {
    min-width: 38px;
    min-height: 38px;
    font-size: 22px;
}


/* v1.0.6: robust floating emoji picker. The panel is moved to <body> by JS, so it cannot be clipped by chat/composer containers. */
body > .dstrc-chat-emoji-panel {
    position: fixed !important;
    z-index: 2147483646 !important;
    display: block;
    border: 1px solid var(--dstrc-chat-border, #c8d7e5) !important;
    background: color-mix(in srgb, var(--dstrc-chat-bg, #ffffff) 96%, #ffffff 4%) !important;
    color: var(--dstrc-chat-text, #111827) !important;
    box-shadow: 0 22px 70px rgba(15, 23, 42, .28) !important;
    overflow: hidden !important;
}
body > .dstrc-chat-emoji-panel[hidden] {
    display: none !important;
}
body > .dstrc-chat-emoji-panel .dstrc-chat-emoji-grid {
    grid-template-columns: repeat(8, minmax(38px, 1fr)) !important;
    max-height: min(360px, calc(100vh - 190px)) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}
body > .dstrc-chat-emoji-panel .dstrc-chat-emoji-item {
    min-width: 38px;
    min-height: 38px;
    font-size: 22px;
}
body > .dstrc-chat-emoji-panel.dstrc-chat-theme-dark,
body > .dstrc-chat-emoji-panel.dstrc-chat-theme-dark .dstrc-chat-emoji-head {
    background: #111827 !important;
    color: #edf7ff !important;
    border-color: #2d3c52 !important;
}
@media (max-width: 520px) {
    body > .dstrc-chat-emoji-panel .dstrc-chat-emoji-grid {
        grid-template-columns: repeat(7, minmax(34px, 1fr)) !important;
    }
    body > .dstrc-chat-emoji-panel .dstrc-chat-emoji-item {
        min-width: 34px;
        min-height: 34px;
        font-size: 21px;
    }
}


/* v1.0.7 — separate scheduled message modal/list */
.dstrc-chat-floating-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.dstrc-chat-floating-modal[hidden] {
    display: none !important;
}

.dstrc-chat-floating-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 13, 24, .38);
    backdrop-filter: blur(8px);
}

.dstrc-chat-floating-modal-card {
    position: relative;
    z-index: 1;
    width: min(560px, calc(100vw - 26px));
    max-height: min(84vh, 720px);
    overflow: auto;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 24px;
    background: var(--dstrc-chat-bg);
    color: var(--dstrc-chat-text);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28), var(--dstrc-chat-raised);
    padding: 14px;
}

.dstrc-chat-floating-modal-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.dstrc-chat-floating-modal-card header button,
.dstrc-chat-modal-actions button,
.dstrc-chat-scheduled-list-actions button {
    appearance: none;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 28%, var(--dstrc-chat-border) 72%);
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 86%, var(--dstrc-chat-primary) 14%);
    color: var(--dstrc-chat-text);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    padding: 8px 12px;
    box-shadow: var(--dstrc-chat-raised);
}

.dstrc-chat-modal-label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 0 0 10px;
    color: var(--dstrc-chat-muted);
    font-size: 12px;
    font-weight: 800;
}

.dstrc-chat-modal-label textarea,
.dstrc-chat-modal-label input {
    width: 100%;
    border: 1px solid var(--dstrc-chat-border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 96%, #ffffff 4%);
    color: var(--dstrc-chat-text);
    font: inherit;
    padding: 11px 13px;
    box-shadow: var(--dstrc-chat-pressed);
}

.dstrc-chat-modal-label textarea {
    min-height: 104px;
    resize: vertical;
}

.dstrc-chat-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 12px;
}

.dstrc-chat-scheduled-list-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dstrc-chat-scheduled-list-item {
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 76%, transparent);
    border-radius: 18px;
    background: color-mix(in srgb, var(--dstrc-chat-panel-bg) 72%, var(--dstrc-chat-bg) 28%);
    padding: 10px;
}

.dstrc-chat-scheduled-list-item p {
    margin: 6px 0 0;
    white-space: pre-wrap;
}

.dstrc-chat-scheduled-list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
}

.dstrc-chat-modal-empty {
    color: var(--dstrc-chat-muted);
    margin: 0;
}

/* v1.0.11 — fixed desktop message edit/delete controls: visible in the bubble, not clipped outside the scroll area. */
.dstrc-chat-message-bubble {
    position: relative;
}

.dstrc-chat-message-actionbar {
    position: absolute;
    z-index: 8;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 3px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 58%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 86%, transparent);
    box-shadow: 0 10px 26px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255,255,255,.35);
    backdrop-filter: blur(8px);
}

.dstrc-chat-message-actionbar .dstrc-chat-message-edit,
.dstrc-chat-message-actionbar .dstrc-chat-message-delete,
.dstrc-chat-message-action {
    appearance: none !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    display: inline-flex !important;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 72%, transparent) !important;
    border-radius: 11px !important;
    background: color-mix(in srgb, var(--dstrc-chat-panel-bg) 90%, var(--dstrc-chat-bg) 10%) !important;
    color: var(--dstrc-chat-text) !important;
    cursor: pointer !important;
    font-size: 15px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    transition: transform .14s ease, color .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease !important;
}

.dstrc-chat-message-actionbar .dstrc-chat-message-edit {
    color: var(--dstrc-chat-primary) !important;
}

.dstrc-chat-message-actionbar .dstrc-chat-message-delete {
    color: var(--dstrc-chat-danger, #d63638) !important;
}

.dstrc-chat-message-actionbar .dstrc-chat-message-edit:hover,
.dstrc-chat-message-actionbar .dstrc-chat-message-edit:focus,
.dstrc-chat-message-actionbar .dstrc-chat-message-delete:hover,
.dstrc-chat-message-actionbar .dstrc-chat-message-delete:focus,
.dstrc-chat-message-action:hover,
.dstrc-chat-message-action:focus {
    outline: none !important;
    transform: translateY(-1px) !important;
    border-color: var(--dstrc-chat-primary) !important;
    background: color-mix(in srgb, var(--dstrc-chat-primary) 16%, var(--dstrc-chat-bg) 84%) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--dstrc-chat-primary) 15%, transparent) !important;
}

.dstrc-chat-message-actionbar .dstrc-chat-message-delete:hover,
.dstrc-chat-message-actionbar .dstrc-chat-message-delete:focus {
    border-color: var(--dstrc-chat-danger, #d63638) !important;
    background: color-mix(in srgb, var(--dstrc-chat-danger, #d63638) 13%, var(--dstrc-chat-bg) 87%) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--dstrc-chat-danger, #d63638) 14%, transparent) !important;
}

.dstrc-chat-theme-dark .dstrc-chat-message-actionbar {
    background: rgba(13, 20, 32, .88);
    border-color: rgba(148, 163, 184, .26);
    box-shadow: 0 12px 30px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.08);
}

.dstrc-chat-theme-dark .dstrc-chat-message-actionbar .dstrc-chat-message-edit,
.dstrc-chat-theme-dark .dstrc-chat-message-actionbar .dstrc-chat-message-delete,
.dstrc-chat-theme-dark .dstrc-chat-message-action {
    background: rgba(24, 34, 51, .94) !important;
    border-color: rgba(148, 163, 184, .30) !important;
    color: #eef6ff !important;
}

.dstrc-chat-theme-dark .dstrc-chat-message-actionbar .dstrc-chat-message-edit {
    color: #7cb7ff !important;
}

.dstrc-chat-theme-dark .dstrc-chat-message-actionbar .dstrc-chat-message-delete {
    color: #ff8b94 !important;
}

@media (max-width: 720px) {
    .dstrc-chat-message-actionbar {
        top: 6px;
        right: 6px;
        gap: 5px;
    }

    .dstrc-chat-message-actionbar .dstrc-chat-message-edit,
    .dstrc-chat-message-actionbar .dstrc-chat-message-delete,
    .dstrc-chat-message-action {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        font-size: 16px !important;
    }
}

.dstrc-chat-message-bubble.has-actions {
    min-height: 54px;
    padding-right: 96px !important;
}

@media (max-width: 720px) {
    .dstrc-chat-message-bubble.has-actions {
        padding-right: 104px !important;
    }
}

/* v1.0.14: self-avatar controls in desktop chat header */
.dstrc-chat-current-user {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.dstrc-chat-current-user-avatar-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.dstrc-chat-avatar-action {
    appearance: none;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 82%, var(--dstrc-chat-primary) 18%);
    border-radius: 10px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 84%, var(--dstrc-chat-primary) 16%);
    color: var(--dstrc-chat-primary);
    cursor: pointer;
    font-weight: 900;
    line-height: 1;
    box-shadow: var(--dstrc-chat-raised);
    transform: translate(-1px, -1px);
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}

.dstrc-chat-avatar-action:hover {
    background: color-mix(in srgb, var(--dstrc-chat-bg) 72%, var(--dstrc-chat-primary) 28%);
}

.dstrc-chat-avatar-action:active {
    box-shadow: var(--dstrc-chat-pressed);
    transform: translate(0, 0);
}

.dstrc-chat-avatar-action.is-danger {
    color: #b42318;
    border-color: color-mix(in srgb, #b42318 42%, var(--dstrc-chat-border) 58%);
    background: color-mix(in srgb, var(--dstrc-chat-bg) 82%, #b42318 18%);
}

.dstrc-chat-avatar-action:disabled {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 560px) {
    .dstrc-chat-current-user {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }
    .dstrc-chat-current-user-avatar-actions {
        grid-column: 2 / 4;
        justify-self: start;
    }
}

/* v1.0.19 media preview: safer desktop cards, lightbox and explicit download actions. */
.dstrc-chat-attachment {
    display: grid;
    max-width: min(460px, 72vw);
    overflow: hidden;
}

.dstrc-chat-attachment-preview-button {
    width: 100%;
    padding: 0;
    border: 0;
    color: inherit;
    cursor: zoom-in;
    text-align: inherit;
}

.dstrc-chat-attachment-preview {
    position: relative;
}

.dstrc-chat-attachment-preview img {
    width: 100%;
    max-width: 100%;
    max-height: 340px;
    background: #000000;
}

.dstrc-chat-attachment-preview-zoom {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
    color: #ffffff;
    font-size: 12px;
    font-weight: 850;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.dstrc-chat-attachment-preview:hover .dstrc-chat-attachment-preview-zoom,
.dstrc-chat-attachment-preview:focus .dstrc-chat-attachment-preview-zoom,
.dstrc-chat-attachment-preview:focus-visible .dstrc-chat-attachment-preview-zoom {
    opacity: 1;
    transform: translateY(0);
}

.dstrc-chat-attachment-video-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 120px;
    padding: 14px;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.14), transparent 0 34%),
        linear-gradient(135deg, rgba(0, 0, 0, 0.88), rgba(36, 33, 61, 0.94));
    color: #ffffff;
}

.dstrc-chat-attachment-video-play {
    display: inline-flex;
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #16172a;
    cursor: pointer;
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.dstrc-chat-attachment-video-play:hover,
.dstrc-chat-attachment-video-play:focus-visible {
    transform: translateY(-1px);
}

.dstrc-chat-attachment-video-info {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.dstrc-chat-attachment-video-info strong {
    font-size: 15px;
    font-weight: 900;
}

.dstrc-chat-attachment-video-info span {
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    font-weight: 700;
}

.dstrc-chat-attachment-audio-card {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px;
}

.dstrc-chat-attachment-audio-icon {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: color-mix(in srgb, var(--dstrc-chat-primary) 13%, transparent);
    color: var(--dstrc-chat-primary);
    font-size: 18px;
}

.dstrc-chat-attachment-audio-main {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.dstrc-chat-attachment-audio-main strong {
    color: var(--dstrc-chat-text);
    font-size: 13px;
    font-weight: 900;
}

.dstrc-chat-attachment-audio {
    width: 100%;
    min-width: 0;
    padding: 0;
}

.dstrc-chat-attachment-file {
    float: none;
    margin: 10px 10px 0;
    text-decoration: none;
}

.dstrc-chat-attachment-file span {
    display: inline-block;
}

.dstrc-chat-attachment-meta {
    gap: 8px;
    padding: 10px 11px 11px;
}

.dstrc-chat-attachment-file + .dstrc-chat-attachment-meta {
    min-height: 0;
    justify-content: stretch;
}

.dstrc-chat-attachment-name-row {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.dstrc-chat-attachment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}

.dstrc-chat-attachment-action {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 10px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 78%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-panel-bg) 86%, transparent);
    color: var(--dstrc-chat-text);
    cursor: pointer;
    font-size: 12px;
    font-weight: 850;
    line-height: 1.1;
    text-decoration: none;
}

.dstrc-chat-attachment-action:hover,
.dstrc-chat-attachment-action:focus-visible {
    border-color: color-mix(in srgb, var(--dstrc-chat-primary) 42%, var(--dstrc-chat-border));
    color: var(--dstrc-chat-primary);
    text-decoration: none;
}

.dstrc-chat-attachment-open {
    border-color: color-mix(in srgb, var(--dstrc-chat-primary) 35%, var(--dstrc-chat-border));
    color: var(--dstrc-chat-primary);
}

.dstrc-chat-media-viewer[hidden] {
    display: none !important;
}

.dstrc-chat-media-viewer {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    place-items: center;
    padding: 24px;
}

.dstrc-chat-media-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 20, 0.78);
    backdrop-filter: blur(8px);
}

.dstrc-chat-media-viewer-card {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(1040px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 58%, transparent);
    border-radius: 22px;
    background: var(--dstrc-chat-panel-bg);
    color: var(--dstrc-chat-text);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

.dstrc-chat-media-viewer-header,
.dstrc-chat-media-viewer-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-color: color-mix(in srgb, var(--dstrc-chat-border) 72%, transparent);
}

.dstrc-chat-media-viewer-header {
    border-bottom: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 72%, transparent);
}

.dstrc-chat-media-viewer-header strong {
    overflow: hidden;
    min-width: 0;
    flex: 1 1 auto;
    font-size: 14px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-media-viewer-close {
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--dstrc-chat-border) 45%, transparent);
    color: var(--dstrc-chat-text);
    cursor: pointer;
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
}

.dstrc-chat-media-viewer-close:hover,
.dstrc-chat-media-viewer-close:focus-visible {
    background: color-mix(in srgb, var(--dstrc-chat-danger) 16%, transparent);
    color: var(--dstrc-chat-danger);
}

.dstrc-chat-media-viewer-body {
    display: grid;
    min-height: 0;
    place-items: center;
    overflow: auto;
    padding: 14px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 76%, #000000 24%);
}

.dstrc-chat-media-viewer-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 180px);
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 18px 56px rgba(0, 0, 0, 0.32);
}

.dstrc-chat-media-viewer-video {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 180px);
    border-radius: 14px;
    background: #000000;
}

.dstrc-chat-media-viewer-footer {
    justify-content: flex-end;
    border-top: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 72%, transparent);
}

.dstrc-chat-media-viewer-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 82%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 72%, transparent);
    color: var(--dstrc-chat-text);
    font-size: 12px;
    font-weight: 850;
    text-decoration: none;
}

.dstrc-chat-media-viewer-action:hover,
.dstrc-chat-media-viewer-action:focus-visible {
    border-color: color-mix(in srgb, var(--dstrc-chat-primary) 44%, var(--dstrc-chat-border));
    color: var(--dstrc-chat-primary);
    text-decoration: none;
}

.dstrc-chat-media-viewer-open {
    overflow: hidden;
}

@media (max-width: 782px) {
    .dstrc-chat-attachment {
        max-width: min(100%, calc(100vw - 70px));
    }

    .dstrc-chat-media-viewer {
        padding: 10px;
    }

    .dstrc-chat-media-viewer-card {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        border-radius: 18px;
    }

    .dstrc-chat-media-viewer-footer {
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .dstrc-chat-media-viewer-action {
        flex: 1 1 140px;
    }
}

/* v1.0.19 media iteration 2: desktop inline media cards and lightbox. */
.dstrc-chat-attachment-preview-button {
    appearance: none;
    position: relative;
    width: 100%;
    padding: 0;
    border: 0;
    cursor: zoom-in;
    text-align: left;
}

.dstrc-chat-attachment-preview-button:focus-visible,
.dstrc-chat-attachment-video-card:focus-visible,
.dstrc-chat-attachment-action:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--dstrc-chat-primary) 78%, transparent);
    outline-offset: 2px;
}

.dstrc-chat-attachment-zoom {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.68);
    color: #ffffff;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    opacity: .92;
    pointer-events: none;
}

.dstrc-chat-attachment-video-card {
    appearance: none;
    display: grid;
    width: min(420px, 68vw);
    max-width: 100%;
    min-height: 168px;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 18px;
    border: 0;
    background:
        radial-gradient(circle at 22% 25%, color-mix(in srgb, var(--dstrc-chat-primary) 30%, transparent), transparent 42%),
        linear-gradient(135deg, rgba(15, 23, 42, .92), rgba(30, 41, 59, .86));
    color: #ffffff;
    cursor: pointer;
    text-align: left;
}

.dstrc-chat-attachment-video-card strong,
.dstrc-chat-attachment-video-card em {
    display: block;
    min-width: 0;
}

.dstrc-chat-attachment-video-card strong {
    font-size: 15px;
    font-weight: 950;
}

.dstrc-chat-attachment-video-card em {
    margin-top: 3px;
    color: rgba(255, 255, 255, .74);
    font-size: 12px;
    font-style: normal;
    font-weight: 750;
}

.dstrc-chat-attachment-video-icon {
    display: inline-flex;
    width: 56px;
    height: 56px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--dstrc-chat-primary) 88%, #ffffff 12%);
    color: #ffffff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .34);
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
}

.dstrc-chat-attachment-audio-card {
    display: grid;
    width: min(420px, 68vw);
    max-width: 100%;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: color-mix(in srgb, var(--dstrc-chat-panel-bg) 66%, transparent);
}

.dstrc-chat-attachment-audio-icon {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    background: color-mix(in srgb, var(--dstrc-chat-primary) 14%, transparent);
    color: var(--dstrc-chat-primary);
    font-size: 22px;
    font-weight: 950;
}

.dstrc-chat-attachment-audio-card .dstrc-chat-attachment-audio {
    width: 100%;
    min-width: 0;
    padding: 0;
}

.dstrc-chat-attachment-actions {
    padding-top: 2px;
}

button.dstrc-chat-attachment-action {
    appearance: none;
    font-family: inherit;
}

.dstrc-chat-attachment-download {
    background: color-mix(in srgb, var(--dstrc-chat-primary) 13%, var(--dstrc-chat-panel-bg));
    color: var(--dstrc-chat-primary);
}

.dstrc-chat-media-lightbox-open {
    overflow: hidden;
}

.dstrc-chat-media-lightbox {
    z-index: 2147483000;
    font-family: var(--dstrc-chat-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif);
}

.dstrc-chat-media-lightbox-viewer {
    display: grid;
    min-height: 0;
    place-items: center;
    overflow: auto;
    padding: 14px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 78%, #000000 22%);
}

.dstrc-chat-media-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(94vh - 170px);
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 18px 56px rgba(0, 0, 0, 0.34);
}

.dstrc-chat-media-lightbox-video {
    display: block;
    width: min(100%, 1040px);
    max-height: calc(94vh - 170px);
    border-radius: 14px;
    background: #000000;
}

.dstrc-chat-media-lightbox-audio {
    display: block;
    width: min(760px, 84vw);
    max-width: 100%;
}

.dstrc-chat-media-lightbox-file {
    display: grid;
    gap: 12px;
    place-items: center;
    color: var(--dstrc-chat-text);
    font-size: 16px;
    font-weight: 850;
    text-align: center;
}

.dstrc-chat-media-lightbox-file::first-letter {
    font-size: 46px;
}

.dstrc-chat-media-lightbox-head strong {
    overflow: hidden;
    min-width: 0;
    flex: 1 1 auto;
    font-size: 14px;
    font-weight: 950;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-media-lightbox-actions a {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 82%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 72%, transparent);
    color: var(--dstrc-chat-text);
    font-size: 12px;
    font-weight: 850;
    text-decoration: none;
}

.dstrc-chat-media-lightbox-actions a:hover,
.dstrc-chat-media-lightbox-actions a:focus-visible {
    border-color: color-mix(in srgb, var(--dstrc-chat-primary) 44%, var(--dstrc-chat-border));
    color: var(--dstrc-chat-primary);
    text-decoration: none;
}

.dstrc-chat-theme-dark.dstrc-chat-media-lightbox .dstrc-chat-media-lightbox-card {
    background: #111827;
    color: #edf7ff;
    border-color: rgba(148, 163, 184, .30);
}

@media (max-width: 782px) {
    .dstrc-chat-attachment-video-card,
    .dstrc-chat-attachment-audio-card {
        width: min(100%, calc(100vw - 76px));
    }

    .dstrc-chat-attachment-video-card {
        min-height: 142px;
        padding: 14px;
    }

    .dstrc-chat-media-lightbox-video,
    .dstrc-chat-media-lightbox-image {
        max-height: calc(96vh - 160px);
    }

    .dstrc-chat-media-lightbox-actions {
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .dstrc-chat-media-lightbox-actions a {
        flex: 1 1 140px;
    }
}

/* Media preview iteration 2: desktop lightbox, richer attachment cards and explicit download actions. */
.dstrc-chat-attachment.has-preview {
    background: color-mix(in srgb, var(--dstrc-chat-bg) 74%, transparent);
}

.dstrc-chat-attachment-image-preview {
    position: relative;
    display: block;
    border-radius: 15px 15px 0 0;
    text-decoration: none;
}

.dstrc-chat-attachment-preview-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, #000 32%, transparent);
    color: #fff;
    font-size: 13px;
    font-weight: 850;
    opacity: 0;
    transition: opacity .16s ease;
}

.dstrc-chat-attachment-image-preview:hover .dstrc-chat-attachment-preview-overlay,
.dstrc-chat-attachment-image-preview:focus .dstrc-chat-attachment-preview-overlay {
    opacity: 1;
}

.dstrc-chat-attachment-preview-overlay span {
    padding: 8px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, #000 42%, transparent);
    box-shadow: 0 10px 26px rgba(0,0,0,.24);
}

.dstrc-chat-attachment-rich-card {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 12px;
    color: var(--dstrc-chat-text);
    text-decoration: none;
    background: linear-gradient(135deg, color-mix(in srgb, var(--dstrc-chat-primary) 18%, transparent), color-mix(in srgb, var(--dstrc-chat-bg) 82%, transparent));
}

.dstrc-chat-attachment-rich-card:hover,
.dstrc-chat-attachment-rich-card:focus {
    color: var(--dstrc-chat-text);
    text-decoration: none;
    background: linear-gradient(135deg, color-mix(in srgb, var(--dstrc-chat-primary) 28%, transparent), color-mix(in srgb, var(--dstrc-chat-bg) 76%, transparent));
}

.dstrc-chat-attachment-rich-icon {
    display: inline-flex;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: color-mix(in srgb, var(--dstrc-chat-primary) 16%, transparent);
    color: var(--dstrc-chat-primary);
    font-size: 22px;
    font-weight: 900;
}

.dstrc-chat-attachment-rich-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.dstrc-chat-attachment-rich-copy strong,
.dstrc-chat-attachment-audio-head strong {
    overflow: hidden;
    font-size: 14px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-attachment-rich-copy small,
.dstrc-chat-attachment-audio-head small {
    overflow: hidden;
    color: var(--dstrc-chat-muted);
    font-size: 12px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-attachment-audio-card {
    display: grid;
    gap: 8px;
    padding: 12px;
}

.dstrc-chat-attachment-audio-head {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.dstrc-chat-attachment-audio-card .dstrc-chat-attachment-audio {
    width: min(420px, 68vw);
    max-width: 100%;
    min-width: 0;
    padding: 0;
}

.dstrc-chat-attachment-file-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 12px 12px 2px;
}

.dstrc-chat-attachment-file-card .dstrc-chat-attachment-file {
    float: none;
    margin: 0;
}

.dstrc-chat-attachment-file-label {
    color: var(--dstrc-chat-muted);
    font-size: 12px;
    font-weight: 800;
}

.dstrc-chat-attachment-name-row {
    display: flex;
    min-width: 0;
    align-items: center;
}

.dstrc-chat-attachment-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.dstrc-chat-attachment-open,
.dstrc-chat-attachment-download {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 4px 9px;
    color: var(--dstrc-chat-primary);
    background: color-mix(in srgb, var(--dstrc-chat-primary) 10%, transparent);
    font-size: 11px;
    font-weight: 850;
    line-height: 1;
    text-decoration: none;
}

.dstrc-chat-attachment-download {
    color: var(--dstrc-chat-text);
    background: color-mix(in srgb, var(--dstrc-chat-border) 30%, transparent);
}

.dstrc-chat-attachment-open:hover,
.dstrc-chat-attachment-open:focus,
.dstrc-chat-attachment-download:hover,
.dstrc-chat-attachment-download:focus {
    color: var(--dstrc-chat-primary);
    text-decoration: none;
    background: color-mix(in srgb, var(--dstrc-chat-primary) 18%, transparent);
}

.dstrc-chat-media-open {
    overflow: hidden;
}

.dstrc-chat-media-lightbox[hidden] {
    display: none !important;
}

.dstrc-chat-media-lightbox {
    position: fixed;
    z-index: 100000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 22px;
}

.dstrc-chat-media-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 10, 18, .74);
    backdrop-filter: blur(14px);
}

.dstrc-chat-media-lightbox-card {
    position: relative;
    z-index: 1;
    display: grid;
    width: min(980px, 96vw);
    max-height: min(92vh, 900px);
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 72%, transparent);
    border-radius: 22px;
    background: var(--dstrc-chat-bg);
    color: var(--dstrc-chat-text);
    box-shadow: 0 30px 90px rgba(0,0,0,.42);
}

.dstrc-chat-media-lightbox-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 70%, transparent);
    background: color-mix(in srgb, var(--dstrc-chat-surface) 88%, transparent);
}

.dstrc-chat-media-lightbox-title {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.dstrc-chat-media-lightbox-title strong {
    overflow: hidden;
    font-size: 14px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-media-lightbox-title span {
    overflow: hidden;
    color: var(--dstrc-chat-muted);
    font-size: 12px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-media-lightbox-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.dstrc-chat-media-lightbox-actions a,
.dstrc-chat-media-lightbox-actions button {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 72%, transparent);
    border-radius: 999px;
    padding: 6px 12px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 92%, transparent);
    color: var(--dstrc-chat-text);
    cursor: pointer;
    font-size: 12px;
    font-weight: 850;
    line-height: 1;
    text-decoration: none;
}

.dstrc-chat-media-lightbox-actions button {
    width: 34px;
    padding: 0;
    font-size: 20px;
}

.dstrc-chat-media-lightbox-actions a:hover,
.dstrc-chat-media-lightbox-actions a:focus,
.dstrc-chat-media-lightbox-actions button:hover,
.dstrc-chat-media-lightbox-actions button:focus {
    border-color: color-mix(in srgb, var(--dstrc-chat-primary) 40%, transparent);
    color: var(--dstrc-chat-primary);
}

.dstrc-chat-media-lightbox-body {
    display: grid;
    min-height: 220px;
    max-height: calc(92vh - 74px);
    overflow: auto;
    place-items: center;
    padding: 16px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 86%, #000 14%);
}

.dstrc-chat-media-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 126px);
    object-fit: contain;
    border-radius: 14px;
}

.dstrc-chat-media-lightbox-video {
    display: block;
    width: min(900px, 92vw);
    max-width: 100%;
    max-height: calc(92vh - 126px);
    border-radius: 14px;
    background: #000;
}

.dstrc-chat-media-lightbox-audio-wrap,
.dstrc-chat-media-lightbox-file {
    display: grid;
    width: min(560px, 92vw);
    gap: 14px;
    justify-items: center;
    padding: 34px 20px;
}

.dstrc-chat-media-lightbox-audio-icon,
.dstrc-chat-media-lightbox-file > div {
    display: inline-flex;
    width: 72px;
    height: 72px;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    background: color-mix(in srgb, var(--dstrc-chat-primary) 18%, transparent);
    color: var(--dstrc-chat-primary);
    font-size: 34px;
}

.dstrc-chat-media-lightbox-audio {
    width: 100%;
}

.dstrc-chat-media-lightbox-file p {
    margin: 0;
    color: var(--dstrc-chat-muted);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

@media (max-width: 720px) {
    .dstrc-chat-media-lightbox {
        padding: 10px;
    }

    .dstrc-chat-media-lightbox-card {
        width: 100%;
        max-height: 94vh;
        border-radius: 18px;
    }

    .dstrc-chat-media-lightbox-head {
        grid-template-columns: 1fr;
    }

    .dstrc-chat-media-lightbox-actions {
        justify-content: flex-start;
    }

    .dstrc-chat-attachment-bottom {
        gap: 5px;
    }
}

.dstrc-chat-attachment-video-play {
    display: inline-flex;
    width: 56px;
    height: 56px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--dstrc-chat-primary) 88%, #ffffff 12%);
    color: #ffffff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .34);
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
}

.dstrc-chat-attachment-video-info,
.dstrc-chat-attachment-audio-main {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.dstrc-chat-attachment-video-info > span {
    color: rgba(255, 255, 255, .74);
    font-size: 12px;
    font-weight: 750;
}

.dstrc-chat-attachment-audio-main > strong {
    color: var(--dstrc-chat-text);
    font-size: 12px;
    font-weight: 900;
}

/* v1.0.19 media iteration 2 final overrides: desktop inline preview/lightbox. */
.dstrc-chat-attachment {
    max-width: min(460px, 72vw);
}

.dstrc-chat-attachment-preview-button,
.dstrc-chat-attachment-video-card {
    appearance: none;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.dstrc-chat-attachment-video-card {
    width: 100%;
    border-radius: 0;
}

.dstrc-chat-attachment-video-card .dstrc-chat-attachment-media {
    width: 100%;
}

.dstrc-chat-attachment-audio-main {
    display: grid;
    min-width: 0;
    gap: 6px;
}

.dstrc-chat-attachment-actions {
    padding: 0;
}

.dstrc-chat-attachment-body .dstrc-chat-attachment-actions,
.dstrc-chat-attachment > .dstrc-chat-attachment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.dstrc-chat-attachment > .dstrc-chat-attachment-actions {
    padding: 0 11px 11px;
}

.dstrc-chat-attachment-file-row {
    color: inherit;
    text-decoration: none;
}

.dstrc-chat-attachment-action span {
    pointer-events: none;
}

.dstrc-chat-media-lightbox-stage video,
.dstrc-chat-media-lightbox-stage audio {
    display: block;
    width: min(100%, 980px);
    max-width: 100%;
}

.dstrc-chat-media-lightbox-stage video {
    max-height: calc(94vh - 160px);
    border-radius: 14px;
    background: #000000;
}

.dstrc-chat-media-lightbox-file {
    display: grid;
    width: min(620px, 100%);
    gap: 14px;
    place-items: center;
    padding: 28px;
    border-radius: 18px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 72%, transparent);
    color: var(--dstrc-chat-text);
    text-align: center;
}

.dstrc-chat-media-lightbox-file > span {
    font-size: 42px;
    line-height: 1;
}

.dstrc-chat-media-lightbox-file audio {
    width: min(520px, 100%);
}

html.dstrc-chat-media-lightbox-open {
    overflow: hidden;
}

@media (max-width: 782px) {
    .dstrc-chat-attachment {
        max-width: min(100%, calc(100vw - 70px));
    }

    .dstrc-chat-attachment-audio-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .dstrc-chat-media-lightbox-file {
        padding: 18px;
    }
}

/* v1.0.19 — desktop media preview: image lightbox, compact video cards, inline audio player. */
.dstrc-chat-attachment {
    display: grid;
    width: min(460px, 72vw);
    max-width: 100%;
    overflow: hidden;
}

.dstrc-chat-attachment-preview-button,
.dstrc-chat-attachment-video-card {
    appearance: none;
    width: 100%;
    border: 0;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.dstrc-chat-attachment-preview-button {
    position: relative;
    display: block;
    padding: 0;
    background: color-mix(in srgb, var(--dstrc-chat-border) 28%, transparent);
    color: inherit;
    cursor: zoom-in;
}

.dstrc-chat-attachment-preview-button img {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: 340px;
    object-fit: contain;
    background: #000000;
}

.dstrc-chat-attachment-preview-zoom {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.68);
    color: #ffffff;
    font-size: 12px;
    font-weight: 850;
    line-height: 1;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.dstrc-chat-attachment-preview-button:hover .dstrc-chat-attachment-preview-zoom,
.dstrc-chat-attachment-preview-button:focus-visible .dstrc-chat-attachment-preview-zoom {
    opacity: 1;
    transform: translateY(0);
}

.dstrc-chat-attachment-video-card {
    display: flex;
    min-height: 124px;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background:
        radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.18), transparent 0 34%),
        linear-gradient(135deg, rgba(0, 0, 0, 0.92), rgba(37, 34, 70, 0.96));
    color: #ffffff;
}

.dstrc-chat-attachment-video-card:hover,
.dstrc-chat-attachment-video-card:focus-visible {
    filter: brightness(1.06);
}

.dstrc-chat-attachment-video-play {
    display: inline-flex;
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: #16172a;
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.dstrc-chat-attachment-video-info {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.dstrc-chat-attachment-video-info strong {
    font-size: 15px;
    font-weight: 900;
}

.dstrc-chat-attachment-video-info span {
    color: rgba(255, 255, 255, 0.76);
    font-size: 12px;
    font-weight: 700;
}

.dstrc-chat-attachment-audio-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px;
}

.dstrc-chat-attachment-audio-icon {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: color-mix(in srgb, var(--dstrc-chat-primary) 13%, transparent);
    color: var(--dstrc-chat-primary);
    font-size: 18px;
}

.dstrc-chat-attachment-audio-main {
    display: grid;
    min-width: 0;
    gap: 7px;
}

.dstrc-chat-attachment-audio-main strong {
    overflow: hidden;
    color: var(--dstrc-chat-text);
    font-size: 13px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-attachment-audio {
    width: 100%;
    min-width: 0;
    padding: 0;
}

.dstrc-chat-attachment-file-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px 11px 4px;
}

.dstrc-chat-attachment-file-text {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.dstrc-chat-attachment-file-text strong,
.dstrc-chat-attachment-file-text span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-attachment-file-text strong {
    color: var(--dstrc-chat-text);
    font-size: 13px;
    font-weight: 900;
}

.dstrc-chat-attachment-file-text span {
    color: var(--dstrc-chat-muted);
    font-size: 12px;
    font-weight: 700;
}

.dstrc-chat-attachment-body,
.dstrc-chat-attachment-meta {
    display: grid;
    min-width: 0;
    gap: 5px;
    padding: 10px 11px 11px;
}

.dstrc-chat-attachment-kind {
    color: var(--dstrc-chat-muted);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.dstrc-chat-attachment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    padding: 0;
}

.dstrc-chat-attachment-action {
    appearance: none;
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 10px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 78%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-panel-bg) 86%, transparent);
    color: var(--dstrc-chat-text);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    line-height: 1.1;
    text-decoration: none;
}

.dstrc-chat-attachment-action:hover,
.dstrc-chat-attachment-action:focus-visible {
    border-color: color-mix(in srgb, var(--dstrc-chat-primary) 42%, var(--dstrc-chat-border));
    color: var(--dstrc-chat-primary);
    text-decoration: none;
}

.dstrc-chat-attachment-open {
    border-color: color-mix(in srgb, var(--dstrc-chat-primary) 35%, var(--dstrc-chat-border));
    color: var(--dstrc-chat-primary);
}

.dstrc-chat-media-lightbox[hidden] {
    display: none !important;
}

.dstrc-chat-media-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    place-items: center;
    padding: 24px;
}

.dstrc-chat-media-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 20, 0.80);
    backdrop-filter: blur(8px);
}

.dstrc-chat-media-lightbox-card {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(1080px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 58%, transparent);
    border-radius: 22px;
    background: var(--dstrc-chat-panel-bg);
    color: var(--dstrc-chat-text);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

.dstrc-chat-media-lightbox-head,
.dstrc-chat-media-lightbox-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-color: color-mix(in srgb, var(--dstrc-chat-border) 72%, transparent);
}

.dstrc-chat-media-lightbox-head {
    justify-content: space-between;
    border-bottom: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 72%, transparent);
}

.dstrc-chat-media-lightbox-title {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.dstrc-chat-media-lightbox-title strong,
.dstrc-chat-media-lightbox-title span {
    overflow: hidden;
    max-width: min(760px, 72vw);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-media-lightbox-title strong {
    font-size: 14px;
    font-weight: 900;
}

.dstrc-chat-media-lightbox-title span {
    color: var(--dstrc-chat-muted);
    font-size: 12px;
    font-weight: 700;
}

.dstrc-chat-media-lightbox-close {
    appearance: none;
    display: inline-flex;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--dstrc-chat-danger) 12%, transparent);
    color: var(--dstrc-chat-danger);
    cursor: pointer;
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
}

.dstrc-chat-media-lightbox-stage {
    display: grid;
    min-height: 0;
    place-items: center;
    overflow: auto;
    padding: 14px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 74%, #000000 26%);
}

.dstrc-chat-media-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 180px);
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 18px 56px rgba(0, 0, 0, 0.32);
}

.dstrc-chat-media-lightbox-video {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 180px);
    border-radius: 14px;
    background: #000000;
}

.dstrc-chat-media-lightbox-audio {
    width: min(720px, calc(100vw - 72px));
}

.dstrc-chat-media-lightbox-file {
    display: grid;
    min-width: min(420px, 78vw);
    gap: 14px;
    justify-items: center;
    padding: 28px;
    color: var(--dstrc-chat-text);
    text-align: center;
}

.dstrc-chat-media-lightbox-file > span {
    font-size: 42px;
}

.dstrc-chat-media-lightbox-actions {
    justify-content: flex-end;
    border-top: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 72%, transparent);
}

.dstrc-chat-media-lightbox-link {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border) 82%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 72%, transparent);
    color: var(--dstrc-chat-text);
    font-size: 12px;
    font-weight: 850;
    text-decoration: none;
}

.dstrc-chat-media-lightbox-link:hover,
.dstrc-chat-media-lightbox-link:focus-visible {
    border-color: color-mix(in srgb, var(--dstrc-chat-primary) 44%, var(--dstrc-chat-border));
    color: var(--dstrc-chat-primary);
    text-decoration: none;
}

.dstrc-chat-media-lightbox-link.is-download {
    background: color-mix(in srgb, var(--dstrc-chat-primary) 12%, transparent);
    color: var(--dstrc-chat-primary);
}

.dstrc-chat-media-lightbox-open {
    overflow: hidden;
}

@media (max-width: 782px) {
    .dstrc-chat-attachment {
        width: min(100%, calc(100vw - 70px));
    }

    .dstrc-chat-attachment-audio-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .dstrc-chat-attachment-audio-icon {
        display: none;
    }

    .dstrc-chat-media-lightbox {
        padding: 10px;
    }

    .dstrc-chat-media-lightbox-card {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        border-radius: 18px;
    }

    .dstrc-chat-media-lightbox-actions {
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .dstrc-chat-media-lightbox-link {
        flex: 1 1 140px;
    }
}

.dstrc-chat-attachment-denied {
    color: var(--dstrc-chat-muted);
    font-size: 11px;
    font-weight: 700;
}

/* Media iteration 5: robust cards, fallbacks and long-file-name handling. */
.dstrc-chat-attachment,
.dstrc-chat-attachment-body,
.dstrc-chat-attachment-meta,
.dstrc-chat-attachment-audio-main,
.dstrc-chat-media-lightbox-stage,
.dstrc-chat-media-lightbox-file {
    min-width: 0;
}

.dstrc-chat-attachment-name,
.dstrc-chat-attachment-kind,
.dstrc-chat-attachment-size,
.dstrc-chat-media-lightbox-title,
.dstrc-chat-media-lightbox-title strong {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.dstrc-chat-attachment-preview,
.dstrc-chat-attachment-video-card,
.dstrc-chat-attachment-audio-card,
.dstrc-chat-attachment-file-row {
    max-width: 100%;
}

.dstrc-chat-attachment-preview img,
.dstrc-chat-media-lightbox-image,
.dstrc-chat-media-lightbox-video,
.dstrc-chat-attachment-audio,
.dstrc-chat-media-lightbox-audio {
    max-width: 100%;
}

.dstrc-chat-attachment-fallback {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px dashed color-mix(in srgb, var(--dstrc-chat-border) 80%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--dstrc-chat-bg) 78%, transparent);
    color: var(--dstrc-chat-muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
}

.dstrc-chat-attachment.is-media-error .dstrc-chat-attachment-fallback,
.dstrc-chat-media-lightbox-stage.is-media-error .dstrc-chat-attachment-fallback {
    display: flex;
}

.dstrc-chat-attachment.is-media-error .dstrc-chat-attachment-preview img,
.dstrc-chat-media-lightbox-stage.is-media-error .dstrc-chat-media-lightbox-image {
    display: none;
}

@media (max-width: 782px) {
    .dstrc-chat-attachment-actions,
    .dstrc-chat-attachment-body .dstrc-chat-attachment-actions,
    .dstrc-chat-media-lightbox-actions {
        flex-wrap: wrap;
    }

    .dstrc-chat-attachment-action,
    .dstrc-chat-media-lightbox-link {
        min-width: 0;
        overflow-wrap: anywhere;
        white-space: normal;
    }
}

/* v1.0.24: desktop voice recording composer panel. */
.dstrc-chat-voice-button {
    position: relative;
}

.dstrc-chat-voice-button.is-recording {
    background: #ef4444 !important;
    color: #fff !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .18), 0 8px 22px rgba(239, 68, 68, .28);
}

.dstrc-chat-voice-button.is-recording::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
    animation: dstrc-chat-voice-pulse 1s infinite;
}

@keyframes dstrc-chat-voice-pulse {
    0%, 100% { opacity: .35; transform: scale(.85); }
    50% { opacity: 1; transform: scale(1.2); }
}

.dstrc-chat-voice-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-top: 10px;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border, #d5dde8) 78%, transparent);
    border-radius: calc(var(--dstrc-chat-radius, 18px) * .85);
    background: color-mix(in srgb, var(--dstrc-chat-panel-bg, #fff) 86%, var(--dstrc-chat-primary, #2563eb) 14%);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
}

.dstrc-chat-voice-panel[hidden] {
    display: none !important;
}

.dstrc-chat-voice-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dstrc-chat-voice-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-primary, #2563eb) 16%, transparent);
    flex: 0 0 auto;
}

.dstrc-chat-voice-panel.is-recording .dstrc-chat-voice-icon {
    background: rgba(239, 68, 68, .16);
    color: #ef4444;
}

.dstrc-chat-voice-info {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.dstrc-chat-voice-info strong {
    color: var(--dstrc-chat-text, #172033);
    font-size: .94rem;
    line-height: 1.2;
}

.dstrc-chat-voice-info span {
    color: var(--dstrc-chat-muted, #64748b);
    font-size: .82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-voice-timer {
    flex: 0 0 auto;
    min-width: 52px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .08);
    color: var(--dstrc-chat-text, #172033);
    font-variant-numeric: tabular-nums;
    text-align: center;
    font-weight: 700;
}

.dstrc-chat-theme-dark .dstrc-chat-voice-timer,
.dstrc-chat-voice-panel.dstrc-chat-theme-dark .dstrc-chat-voice-timer {
    background: rgba(255, 255, 255, .08);
}

.dstrc-chat-voice-preview {
    width: 100%;
    max-width: 100%;
}

.dstrc-chat-voice-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.dstrc-chat-voice-action {
    border: 0;
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
    font-weight: 700;
    background: color-mix(in srgb, var(--dstrc-chat-primary, #2563eb) 12%, var(--dstrc-chat-panel-bg, #fff) 88%);
    color: var(--dstrc-chat-text, #172033);
}

.dstrc-chat-voice-action:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .12);
}

.dstrc-chat-voice-action:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.dstrc-chat-voice-action.is-stop {
    background: #ef4444;
    color: #fff;
}

.dstrc-chat-voice-action.is-send {
    background: var(--dstrc-chat-primary, #2563eb);
    color: #fff;
}

@media (max-width: 720px) {
    .dstrc-chat-voice-main {
        align-items: flex-start;
    }
    .dstrc-chat-voice-timer {
        min-width: 48px;
    }
    .dstrc-chat-voice-actions {
        justify-content: stretch;
    }
    .dstrc-chat-voice-action {
        flex: 1 1 auto;
    }
}

/* v1.0.24 hotfix: align desktop voice recorder markup and styles. */
.dstrc-chat-voice-card {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.dstrc-chat-voice-text,
.dstrc-chat-voice-info {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.dstrc-chat-voice-text strong,
.dstrc-chat-voice-info strong {
    color: var(--dstrc-chat-text, #172033);
    font-size: .94rem;
    line-height: 1.2;
}

.dstrc-chat-voice-text span,
.dstrc-chat-voice-info span {
    color: var(--dstrc-chat-muted, #64748b);
    font-size: .82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-voice-progress {
    width: 100%;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(15, 23, 42, .12);
}

.dstrc-chat-theme-dark .dstrc-chat-voice-progress {
    background: rgba(255, 255, 255, .12);
}

.dstrc-chat-voice-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--dstrc-chat-primary, #2563eb);
    transition: width .2s ease;
}

.dstrc-chat-voice-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 34px;
    overflow: hidden;
}

.dstrc-chat-voice-waveform > span {
    display: block;
    width: 3px;
    min-height: 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-primary, #2563eb) 68%, transparent);
    flex: 1 1 3px;
}

/* v1.0.24: rendered desktop voice recorder card and waveform. */
.dstrc-chat-voice-card {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.dstrc-chat-voice-card .dstrc-chat-voice-text {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.dstrc-chat-voice-card .dstrc-chat-voice-text strong {
    color: var(--dstrc-chat-text, #172033);
    font-size: .94rem;
    line-height: 1.2;
}

.dstrc-chat-voice-card .dstrc-chat-voice-text span {
    color: var(--dstrc-chat-muted, #64748b);
    font-size: .82rem;
    overflow-wrap: anywhere;
}

.dstrc-chat-voice-card-recording .dstrc-chat-voice-icon {
    background: rgba(239, 68, 68, .16);
    color: #ef4444;
}

.dstrc-chat-voice-progress {
    width: 100%;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-muted, #64748b) 18%, transparent);
}

.dstrc-chat-voice-progress span {
    display: block;
    height: 100%;
    min-width: 3px;
    border-radius: inherit;
    background: var(--dstrc-chat-primary, #2563eb);
    transition: width .2s ease;
}

.dstrc-chat-voice-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    min-height: 34px;
    padding: 4px 0;
    overflow: hidden;
}

.dstrc-chat-voice-waveform span {
    display: inline-block;
    width: 3px;
    min-height: 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-primary, #2563eb) 72%, var(--dstrc-chat-panel-bg, #fff) 28%);
    flex: 0 0 auto;
}

/* v1.0.25: improved voice message bubble, waveform and speed controls. */
.dstrc-chat-voice-message-bubble {
    display: grid;
    gap: 10px;
    min-width: 240px;
    max-width: min(430px, 72vw);
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border, #d5dde8) 70%, transparent);
    border-radius: 18px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--dstrc-chat-primary, #2563eb) 12%, transparent), color-mix(in srgb, var(--dstrc-chat-panel-bg, #fff) 88%, transparent));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.16);
}

.dstrc-chat-message.is-own .dstrc-chat-voice-message-bubble {
    background: linear-gradient(135deg, color-mix(in srgb, var(--dstrc-chat-primary, #2563eb) 22%, transparent), color-mix(in srgb, var(--dstrc-chat-panel-bg, #fff) 78%, transparent));
}

.dstrc-chat-theme-dark .dstrc-chat-voice-message-bubble,
.dstrc-chat-message-bubble.dstrc-chat-theme-dark .dstrc-chat-voice-message-bubble {
    background: linear-gradient(135deg, color-mix(in srgb, var(--dstrc-chat-primary, #8b5cf6) 24%, #111827 76%), color-mix(in srgb, #0f172a 88%, transparent));
    border-color: rgba(255,255,255,.12);
}

.dstrc-chat-voice-message-head {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.dstrc-chat-voice-message-icon {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-primary, #2563eb) 18%, transparent);
    color: var(--dstrc-chat-primary, #2563eb);
    font-size: 21px;
    box-shadow: 0 8px 20px rgba(15,23,42,.10);
}

.dstrc-chat-voice-message-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.dstrc-chat-voice-message-copy strong {
    overflow: hidden;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.18;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-voice-message-copy small {
    overflow: hidden;
    color: var(--dstrc-chat-muted, #64748b);
    font-size: 12px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dstrc-chat-voice-message-waveform,
.dstrc-chat-voice-speed {
    display: flex;
    align-items: center;
}

.dstrc-chat-voice-message-waveform {
    gap: 3px;
    height: 38px;
    overflow: hidden;
    padding: 4px 0;
}

.dstrc-chat-voice-message-waveform i,
.dstrc-chat-voice-waveform i {
    display: block;
    width: 3px;
    min-height: 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--dstrc-chat-primary, #2563eb) 72%, transparent);
    flex: 1 1 3px;
}

.dstrc-chat-voice-message-audio,
.dstrc-chat-media-lightbox-audio {
    width: 100%;
    max-width: 100%;
}

.dstrc-chat-voice-speed {
    gap: 6px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.dstrc-chat-voice-speed button {
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-border, #d5dde8) 70%, transparent);
    border-radius: 999px;
    padding: 4px 9px;
    cursor: pointer;
    background: color-mix(in srgb, var(--dstrc-chat-panel-bg, #fff) 86%, var(--dstrc-chat-primary, #2563eb) 14%);
    color: var(--dstrc-chat-text, #172033);
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.dstrc-chat-voice-speed button.is-active,
.dstrc-chat-voice-speed button:hover,
.dstrc-chat-voice-speed button:focus-visible {
    border-color: var(--dstrc-chat-primary, #2563eb);
    background: var(--dstrc-chat-primary, #2563eb);
    color: #fff;
}

.dstrc-chat-media-lightbox-audio-wrap {
    display: grid;
    gap: 10px;
    min-width: min(560px, 78vw);
}

@media (max-width: 720px) {
    .dstrc-chat-voice-message-bubble {
        min-width: 0;
        max-width: 100%;
    }
    .dstrc-chat-voice-message-waveform i,
    .dstrc-chat-voice-waveform i {
        width: 2px;
        flex-basis: 2px;
    }
}

/* v1.0.25 hotfix: live voice waveform progress in rendered messages. */
.dstrc-chat-voice-message-waveform i,
.dstrc-chat-voice-waveform i {
    opacity: .38;
    transition: opacity .16s ease, background-color .16s ease, transform .16s ease;
}

.dstrc-chat-voice-message-waveform i.is-active,
.dstrc-chat-voice-waveform i.is-active,
.dstrc-chat-voice-message-bubble.is-playing .dstrc-chat-voice-message-icon {
    opacity: 1;
}

.dstrc-chat-voice-message-waveform i.is-active,
.dstrc-chat-voice-waveform i.is-active {
    background: var(--dstrc-chat-primary, #2563eb);
}

/* v1.0.34 — safer scheduled date/time controls and persistent unread badge styling */
.dstrc-chat-unread-badge {
    background: #dc2626;
    color: #ffffff;
}

.dstrc-chat-modal-datetime,
.dstrc-chat-schedule-datetime-fields,
.dstrc-chat-inline-schedule-fields {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(120px, .7fr);
    gap: 10px;
    align-items: end;
}

.dstrc-chat-schedule-datetime-fields label,
.dstrc-chat-inline-schedule-fields label {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dstrc-chat-inline-schedule-title {
    color: var(--dstrc-chat-muted);
    font-size: calc(var(--dstrc-chat-font-size) - 2px);
    font-weight: 900;
}

.dstrc-chat-schedule-panel input[type="date"],
.dstrc-chat-schedule-panel input[type="time"],
.dstrc-chat-inline-schedule input[type="date"],
.dstrc-chat-inline-schedule input[type="time"],
.dstrc-chat-modal-datetime input[type="date"],
.dstrc-chat-modal-datetime input[type="time"] {
    width: 100%;
    border: 1px solid color-mix(in srgb, var(--dstrc-chat-primary) 26%, var(--dstrc-chat-border) 74%);
    border-radius: 12px;
    background: var(--dstrc-chat-bg);
    color: var(--dstrc-chat-text);
    font-family: inherit;
    font-size: calc(var(--dstrc-chat-font-size) - 1px);
    padding: 8px 10px;
}

.dstrc-chat-schedule-panel input[type="date"]:focus,
.dstrc-chat-schedule-panel input[type="time"]:focus,
.dstrc-chat-inline-schedule input[type="date"]:focus,
.dstrc-chat-inline-schedule input[type="time"]:focus,
.dstrc-chat-modal-datetime input[type="date"]:focus,
.dstrc-chat-modal-datetime input[type="time"]:focus {
    border-color: var(--dstrc-chat-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--dstrc-chat-primary) 18%, transparent);
    outline: none;
}

@media (max-width: 640px) {
    .dstrc-chat-modal-datetime,
    .dstrc-chat-schedule-datetime-fields,
    .dstrc-chat-inline-schedule-fields {
        grid-template-columns: 1fr;
    }
}
