/* ═══════════════════════════════════════════════════════════
   ZibChat - Discord-style Chatroom Styles
   BEM naming with .zc- prefix to avoid conflicts
   Reuses Zibll CSS variables for theme compatibility
   ═══════════════════════════════════════════════════════════ */

/* ─── CSS Variables (fallbacks for non-Zibll environments) ─ */
:root {
    --zc-primary: var(--theme-color, #5865f2);
    --zc-primary-hover: var(--theme-color-hover, #4752c4);
    --zc-bg-primary: var(--body-bg-color, #313338);
    --zc-bg-secondary: var(--main-bg-color, #2b2d31);
    --zc-bg-tertiary: #1e1f22;
    --zc-text-primary: var(--key-color, #f2f3f5);
    --zc-text-secondary: var(--main-color, #b5bac1);
    --zc-text-muted: var(--muted-color, #949ba4);
    --zc-border: var(--main-border-color, #3f4147);
    --zc-hover: rgba(79, 84, 92, 0.32);
    --zc-active: rgba(79, 84, 92, 0.48);
    --zc-success: #23a55a;
    --zc-danger: #f23f43;
    --zc-warning: #f0b232;
    --zc-sidebar-width: 240px;
    --zc-members-width: 240px;
    --zc-header-height: 48px;
    --zc-input-height: auto;
    --zc-radius: 8px;
    --zc-radius-sm: 4px;
    --zc-safe-top: env(safe-area-inset-top, 0px);
    --zc-safe-bottom: env(safe-area-inset-bottom, 0px);
    --zc-bubble-other-bg: color-mix(in srgb, var(--zc-bg-secondary) 86%, #ffffff 14%);
    --zc-bubble-other-border: color-mix(in srgb, var(--zc-border) 78%, #ffffff 22%);
    --zc-bubble-self-bg: linear-gradient(135deg, #4b515c 0%, #3f444d 100%);
    --zc-bubble-self-border: rgba(255, 255, 255, 0.09);
    --zc-bubble-self-text: #f4f6f8;
    --zc-bubble-self-muted: rgba(244, 246, 248, 0.8);
    --zc-bubble-self-link: #f7deb0;
    --zc-panel-strong: #3c4152;
    --zc-panel-strong-hover: #40445b;
    --zc-overlay-dark: rgba(9, 12, 18, 0.82);
    --zc-shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.4);
    --zc-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --zc-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --zc-white-soft: rgba(255, 255, 255, 0.12);
    --zc-white-softer: rgba(255, 255, 255, 0.08);
    --zc-white-faint: rgba(255, 255, 255, 0.06);
    --zc-accent-soft: rgba(88, 101, 242, 0.15);
    --zc-accent-strong: rgba(88, 101, 242, 0.3);
    --zc-mask: rgba(0, 0, 0, 0.5);
}

.zc-page:not(.dark-theme) {
    --zc-bg-primary: var(--body-bg-color, #f5f6f7);
    --zc-bg-secondary: var(--main-bg-color, #ffffff);
    --zc-bg-tertiary: color-mix(in srgb, var(--main-bg-color, #fff) 70%, #eef2f7 30%);
    --zc-text-primary: var(--key-color, #222b38);
    --zc-text-secondary: var(--main-color, #596273);
    --zc-text-muted: var(--muted-color, #8a94a6);
    --zc-border: var(--main-border-color, rgba(50, 50, 50, 0.08));
    --zc-hover: rgba(77, 99, 124, 0.08);
    --zc-active: rgba(77, 99, 124, 0.14);
    --zc-bubble-other-bg: color-mix(in srgb, var(--main-bg-color, #fff) 88%, #eef2f7 12%);
    --zc-bubble-other-border: color-mix(in srgb, var(--main-border-color, rgba(0,0,0,0.08)) 72%, #dbe3ec 28%);
    --zc-bubble-self-bg: linear-gradient(135deg, #5f6f85 0%, #506177 100%);
    --zc-bubble-self-border: rgba(29, 40, 56, 0.08);
    --zc-bubble-self-text: #f7fafc;
    --zc-bubble-self-muted: rgba(247, 250, 252, 0.84);
    --zc-bubble-self-link: #fff2c9;
    --zc-panel-strong: color-mix(in srgb, var(--main-bg-color, #fff) 78%, #e9eef5 22%);
    --zc-panel-strong-hover: color-mix(in srgb, var(--main-bg-color, #fff) 70%, #e1e8f0 30%);
    --zc-overlay-dark: rgba(244, 247, 251, 0.92);
    --zc-shadow-lg: 0 24px 60px rgba(57, 72, 92, 0.16);
    --zc-shadow-md: 0 4px 16px rgba(57, 72, 92, 0.14);
    --zc-shadow-sm: 0 2px 8px rgba(57, 72, 92, 0.12);
    --zc-white-soft: rgba(34, 43, 56, 0.08);
    --zc-white-softer: rgba(34, 43, 56, 0.06);
    --zc-white-faint: rgba(34, 43, 56, 0.04);
    --zc-accent-soft: color-mix(in srgb, var(--theme-color, #5865f2) 14%, transparent);
    --zc-accent-strong: color-mix(in srgb, var(--theme-color, #5865f2) 26%, transparent);
    --zc-mask: rgba(68, 83, 103, 0.18);
}

/* ─── Reset & Base ─────────────────────────────────────── */
.zc-page {
    margin: 0;
    padding: 0;
    overflow: hidden;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--zc-text-primary);
    background: var(--zc-bg-primary);
}

.zc-page.zc-with-theme-header {
    --zc-theme-offset: 64px;
}

.zc-page *, .zc-page *::before, .zc-page *::after {
    box-sizing: border-box;
}

.zc-page.nav-fixed {
    padding-top: var(--zc-theme-offset, 64px) !important;
}

/* Hide theme-level mobile footer bars on the dedicated chat shell. */
.zc-page .footer-tabbar,
.zc-page .footer-tabbar-placeholder {
    display: none !important;
}

/* ─── App Layout (Three-column) ────────────────────────── */
.zc-app {
    display: flex;
    min-height: calc(100vh - var(--zc-theme-offset, 0px));
    min-height: calc(100dvh - var(--zc-theme-offset, 0px));
    height: calc(100vh - var(--zc-theme-offset, 0px));
    height: calc(100dvh - var(--zc-theme-offset, 0px));
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
}

/* ─── Left Sidebar (Channels) ──────────────────────────── */
.zc-sidebar {
    width: var(--zc-sidebar-width);
    min-width: var(--zc-sidebar-width);
    background: var(--zc-bg-secondary);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--zc-border);
}

.zc-sidebar__header {
    height: var(--zc-header-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--zc-border);
    flex-shrink: 0;
}

.zc-sidebar__title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: var(--zc-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zc-sidebar__home {
    color: var(--zc-text-muted);
    text-decoration: none;
    font-size: 16px;
    padding: 4px;
    border-radius: var(--zc-radius-sm);
    transition: color 0.15s, background 0.15s;
}

.zc-sidebar__home:hover {
    color: var(--zc-text-primary);
    background: var(--zc-hover);
}

.zc-sidebar__search {
    padding: 8px 10px;
    flex-shrink: 0;
}

.zc-channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 8px;
}

/* Channel group */
.zc-channel-group__title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--zc-text-muted);
    padding: 16px 8px 4px;
    margin: 0;
    letter-spacing: 0.02em;
    cursor: default;
}

/* Channel item */
.zc-channel-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    margin: 1px 0;
    border-radius: var(--zc-radius-sm);
    cursor: pointer;
    color: var(--zc-text-muted);
    text-decoration: none;
    transition: background 0.1s, color 0.1s;
    position: relative;
}

.zc-channel-item:hover {
    background: var(--zc-hover);
    color: var(--zc-text-secondary);
}

.zc-channel-item--active {
    background: var(--zc-active);
    color: var(--zc-text-primary);
}

.zc-channel-item__icon {
    font-size: 18px;
    margin-right: 8px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
}

.zc-channel-item--active .zc-channel-item__icon {
    opacity: 1;
}

.zc-channel-item__name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
}

.zc-channel-item__flag {
    flex-shrink: 0;
    margin-left: 8px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1.2;
    color: var(--zc-text-secondary);
    background: color-mix(in srgb, var(--zc-active) 58%, transparent);
    border: 1px solid color-mix(in srgb, var(--zc-border) 76%, transparent);
}

.zc-channel-item__badge {
    background: var(--zc-danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    padding: 0 5px;
    flex-shrink: 0;
}

/* User panel at bottom of sidebar */
.zc-sidebar__footer {
    padding: 8px;
    border-top: 1px solid var(--zc-border);
    flex-shrink: 0;
    background: var(--zc-bg-tertiary);
}

.zc-user-panel {
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: var(--zc-radius-sm);
}

.zc-sidebar__dm-btn {
    width: 100%;
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.zc-user-panel__avatar {
    position: relative;
    flex-shrink: 0;
    margin-right: 8px;
}

.zc-user-panel__avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: block;
}

.zc-user-panel__info {
    flex: 1;
    min-width: 0;
}

.zc-user-panel__name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--zc-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zc-user-panel__status {
    display: block;
    font-size: 11px;
    color: var(--zc-text-muted);
}

.zc-user-panel__actions {
    position: relative;
}

/* Status dot */
.zc-status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--zc-bg-tertiary);
}

.zc-status-dot--online { background: var(--zc-success); }
.zc-status-dot--idle { background: var(--zc-warning); }
.zc-status-dot--busy { background: var(--zc-danger); }
.zc-status-dot--offline { background: var(--zc-text-muted); }

.zc-status-menu {
    position: absolute;
    left: 100%;
    bottom: 0;
    margin-left: 10px;
    width: 220px;
    padding: 8px;
    border: 1px solid var(--zc-border);
    border-radius: 16px;
    background: var(--zc-bg-secondary);
    box-shadow: var(--zc-shadow-md);
    display: none;
    z-index: 45;
}

.zc-status-menu.is-open {
    display: block;
}

.zc-status-menu__item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--zc-text-primary);
    cursor: pointer;
    text-align: left;
}

.zc-status-menu__item .zc-status-dot {
    position: static;
    width: 12px;
    height: 12px;
    border-width: 0;
    flex: 0 0 auto;
}

.zc-status-menu__item:hover,
.zc-status-menu__item.is-active {
    background: var(--zc-hover);
}

.zc-status-menu__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.zc-status-menu__meta strong {
    font-size: 13px;
}

.zc-status-menu__meta small {
    font-size: 11px;
    color: var(--zc-text-muted);
}

/* ─── Main Chat Area ───────────────────────────────────── */
.zc-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    width: 0;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: var(--zc-bg-primary);
}

.zc-notice-ticker-wrap {
    flex-shrink: 0;
    padding: 10px 18px 0;
    background: var(--zc-bg-primary);
}

.zc-notice-ticker {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--zc-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--zc-bg-secondary) 88%, #ffffff 12%);
    overflow: hidden;
    box-shadow: inset 0 1px 0 var(--zc-white-faint);
}

.zc-notice-ticker__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 6px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.16) 0%, rgba(56, 189, 248, 0.08) 100%);
    color: var(--zc-text-primary);
    font-size: 12px;
    font-weight: 700;
}

.zc-notice-ticker__badge i {
    color: #f59e0b;
}

.zc-notice-ticker__viewport {
    position: relative;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.zc-notice-ticker__track {
    display: inline-flex;
    align-items: center;
    gap: 36px;
    min-width: max-content;
    padding-right: 36px;
    animation: zcNoticeTicker 40s linear infinite;
    will-change: transform;
}

.zc-notice-ticker:hover .zc-notice-ticker__track {
    animation-play-state: paused;
}

.zc-notice-ticker__item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--zc-text-secondary);
    font-size: 13px;
    line-height: 1.6;
    white-space: nowrap;
}

.zc-notice-ticker__item::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12);
    flex-shrink: 0;
}

@keyframes zcNoticeTicker {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

/* Chat header */
.zc-chat-header {
    height: var(--zc-header-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--zc-border);
    flex-shrink: 0;
    background: var(--zc-bg-primary);
    position: relative;
    z-index: 2;
}

.zc-chat-header__info {
    flex: 1;
    min-width: 0;
}

.zc-chat-header__name {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--zc-text-primary);
}

.zc-chat-header__name i {
    color: var(--zc-text-muted);
    font-size: 18px;
}

.zc-chat-header__desc {
    font-size: 12px;
    color: var(--zc-text-muted);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zc-chat-header__actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    align-items: center;
}

.zc-chat-header__actions .zc-btn {
    height: 34px;
    padding: 0 14px;
    border-radius: 999px;
}

/* ─── Messages ─────────────────────────────────────────── */
.zc-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    scroll-behavior: smooth;
}

.zc-messages__list {
    padding: 16px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 24px;
}

.zc-messages__loader {
    text-align: center;
    padding: 12px;
}

/* Single message */
.zc-message {
    display: flex;
    align-items: flex-start;
    padding: 4px 16px;
    margin: 0 -16px;
    position: relative;
    transition: background 0.1s;
}

.zc-message:hover {
    background: transparent;
}

.zc-message:hover .zc-message__content {
    border-color: color-mix(in srgb, var(--zc-border) 88%, #ffffff 12%);
}

.zc-message--mine:hover .zc-message__content {
    border-color: color-mix(in srgb, var(--zc-bubble-self-border) 82%, #ffffff 18%);
}

.zc-message__avatar {
    flex-shrink: 0;
    margin-right: 12px;
    margin-top: 2px;
}

.zc-message__avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: block;
    cursor: pointer;
}

.zc-message__body {
    flex: 0 1 auto;
    min-width: 0;
    width: fit-content;
    max-width: min(100%, 620px);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.zc-message--mine {
    flex-direction: row-reverse;
}

.zc-message--mine .zc-message__avatar {
    margin-right: 0;
    margin-left: 12px;
}

.zc-message--mine .zc-message__body {
    align-items: flex-end;
}

.zc-message__header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.zc-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 18px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.01em;
    flex-shrink: 0;
}

.zc-badge--owner {
    background: linear-gradient(135deg, #f0b232 0%, #e6a820 100%);
    color: #1a1a1a;
    box-shadow: 0 4px 10px rgba(230, 168, 32, 0.18);
}

.zc-badge--manager {
    background: linear-gradient(135deg, #4c7df0 0%, #3f67db 100%);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(63, 103, 219, 0.18);
}

.zc-badge--staff {
    background: linear-gradient(135deg, #11b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.18);
}

.zc-message__author {
    font-weight: 600;
    color: var(--zc-text-primary);
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
}

.zc-message__author:hover {
    text-decoration: underline;
}

.zc-message__time {
    font-size: 11px;
    color: var(--zc-text-muted);
    flex-shrink: 0;
}

.zc-message__edited {
    font-size: 11px;
    color: var(--zc-text-muted);
}

.zc-message__status {
    margin-top: 4px;
    display: flex;
    align-items: center;
}

.zc-message--mine .zc-message__status {
    justify-content: flex-end;
}

.zc-message__read-count {
    font-size: 11px;
    color: var(--zc-text-muted);
    line-height: 1.2;
    cursor: pointer;
}

.zc-message__read-count:hover {
    color: var(--zc-primary, #4a90d9);
    text-decoration: underline;
}

/* ── Read Detail Popup ─────────────────────────── */
.zc-read-detail-popup {
    background: var(--zc-bg-primary, #fff);
    border: 1px solid var(--zc-border, #e0e0e0);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    min-width: 200px;
    max-width: 280px;
    max-height: 320px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-size: 13px;
}

.zc-read-detail-popup__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--zc-border, #e0e0e0);
}

.zc-read-detail-popup__title {
    font-weight: 600;
    font-size: 13px;
}

.zc-read-detail-popup__close {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: var(--zc-text-muted);
    padding: 0 2px;
}

.zc-read-detail-popup__close:hover {
    color: var(--zc-text-primary);
}

.zc-read-detail-popup__body {
    overflow-y: auto;
    padding: 6px 0;
    flex: 1;
}

.zc-read-detail-popup__list {
    display: flex;
    flex-direction: column;
}

.zc-read-detail-popup__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
}

.zc-read-detail-popup__item:hover {
    background: var(--zc-bg-hover, #f5f5f5);
}

.zc-read-detail-popup__avatar {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.zc-read-detail-popup__avatar img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.zc-read-detail-popup__name {
    font-size: 13px;
    color: var(--zc-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zc-read-detail-popup__empty {
    text-align: center;
    padding: 16px 12px;
    color: var(--zc-text-muted);
    font-size: 12px;
}

.zc-read-detail-popup__footer {
    padding: 6px 12px;
    border-top: 1px solid var(--zc-border, #e0e0e0);
    font-size: 11px;
    color: var(--zc-text-muted);
    text-align: center;
}

.zc-message__content {
    color: var(--zc-text-secondary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.45;
    display: inline-flex;
    flex-direction: column;
    align-self: flex-start;
    background: var(--zc-bubble-other-bg);
    border: 1px solid var(--zc-bubble-other-border);
    border-radius: 18px;
    padding: 10px 14px;
    max-width: min(100%, 560px);
    box-shadow: inset 0 1px 0 var(--zc-white-faint);
}

.zc-message--mine .zc-message__header {
    justify-content: flex-end;
}

.zc-message--mine .zc-message__content {
    align-self: flex-end;
    background: var(--zc-bubble-self-bg);
    border-color: var(--zc-bubble-self-border);
    color: var(--zc-bubble-self-text);
    box-shadow:
        inset 0 1px 0 var(--zc-white-soft),
        0 10px 22px color-mix(in srgb, var(--zc-mask) 80%, transparent);
}

.zc-message--mine .zc-message__content .zc-link,
.zc-message--mine .zc-message__content .zc-mention {
    color: var(--zc-bubble-self-link);
}

.zc-message--mine .zc-message__content .zc-mention {
    background: var(--zc-white-soft);
}

.zc-message--mine .zc-message__reply {
    text-align: right;
}

.zc-message__content img.zc-msg-img,
.zc-message__content .zc-media__img {
    max-width: min(360px, 58vw);
    max-height: 320px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--zc-radius);
    margin: 4px 0;
    cursor: pointer;
    display: block;
}

.zc-message__content:has(> .zc-media--image),
.zc-message__content:has(> img.zc-msg-img) {
    padding: 6px;
    background: transparent;
    border-color: transparent;
    color: var(--zc-text-primary);
    box-shadow: none;
}

.zc-message--mine .zc-message__content:has(> .zc-media--image),
.zc-message--mine .zc-message__content:has(> img.zc-msg-img),
.zc-message__content:has(> .zc-img-grid) {
    color: var(--zc-text-primary);
}

.zc-message__content .zc-media {
    margin: 4px 0;
    width: fit-content;
}

.zc-message__content .zc-img-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    width: min(360px, 68vw);
    overflow: hidden;
    border-radius: 12px;
}

.zc-message__content .zc-img-grid--count-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.zc-message__content .zc-img-grid--count-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.zc-message__content .zc-img-grid__item {
    aspect-ratio: 1 / 1;
    min-width: 0;
    overflow: hidden;
    background: var(--zc-bg-tertiary);
}

.zc-message__content .zc-img-grid__item .zc-media,
.zc-message__content .zc-img-grid__item .zc-media__link {
    width: 100%;
    height: 100%;
    margin: 0;
}

.zc-message__content .zc-img-grid__item img.zc-msg-img,
.zc-message__content .zc-img-grid__item .zc-media__img {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    object-fit: cover;
}

.zc-message__content:has(> .zc-img-grid) {
    padding: 6px;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.zc-message__content .zc-media--image {
    display: inline-flex;
    flex-direction: column;
    position: relative;
    margin: 0;
    border-radius: 24px;
    overflow: hidden;
    background: color-mix(in srgb, var(--zc-bg-secondary) 86%, #ffffff 14%);
    border: 1px solid color-mix(in srgb, var(--zc-border) 72%, transparent);
    box-shadow:
        0 18px 36px color-mix(in srgb, var(--zc-mask) 42%, transparent),
        inset 0 1px 0 var(--zc-white-faint);
}

.zc-message__content .zc-media__link {
    display: block;
    line-height: 0;
}

.zc-message__content .zc-media--image .zc-media__img {
    margin: 0;
    border-radius: 0;
    max-width: min(420px, 60vw);
    max-height: 380px;
}

.zc-message__content .zc-media--image .zc-media__size {
    display: none;
}

.zc-message--mine .zc-message__content .zc-media--image {
    background: color-mix(in srgb, var(--zc-bubble-self-bg) 72%, #ffffff 28%);
    border-color: color-mix(in srgb, var(--zc-bubble-self-border) 60%, transparent);
    box-shadow:
        0 18px 32px color-mix(in srgb, var(--zc-mask) 34%, transparent),
        inset 0 1px 0 var(--zc-white-soft);
}

.zc-message__content .zc-media--file,
.zc-message__content .zc-media--voice,
.zc-message__content .zc-media--video {
    max-width: min(100%, 380px);
}

.zc-message__content .zc-file-link,
.zc-message__content .zc-media__download {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    min-width: min(280px, 52vw);
    max-width: min(360px, 58vw);
    border-radius: 14px;
    background: var(--zc-white-faint);
    border: 1px solid var(--zc-border);
    color: inherit;
    text-decoration: none;
}

.zc-message--mine .zc-message__content .zc-file-link,
.zc-message--mine .zc-message__content .zc-media__download {
    background: var(--zc-white-softer);
    border-color: var(--zc-white-soft);
}

.zc-message__content .zc-file-icon {
    font-size: 20px;
    width: 22px;
    text-align: center;
    color: var(--zc-primary);
}

.zc-message--mine .zc-message__content .zc-file-icon {
    color: var(--zc-bubble-self-link);
}

.zc-message__content .zc-file-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.zc-message__content .zc-file-size,
.zc-message__content .zc-media__size {
    font-size: 12px;
    color: var(--zc-text-muted);
}

.zc-message--mine .zc-message__content .zc-file-size,
.zc-message--mine .zc-message__content .zc-media__size {
    color: var(--zc-bubble-self-muted);
}

.zc-message__content .zc-media__video {
    display: block;
    max-width: min(360px, 58vw);
    border-radius: 14px;
    margin-bottom: 8px;
    background: var(--zc-mask);
}

.zc-message__content .zc-voice-player {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--zc-border);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    margin-bottom: 8px;
}

.zc-message__content .zc-media__size {
    margin-top: 4px;
    align-self: flex-end;
}

body.zc-image-preview-open {
    overflow: hidden;
}

.zc-image-preview {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: var(--zc-overlay-dark);
    backdrop-filter: blur(4px);
}

.zc-image-preview__img {
    display: block;
    max-width: min(92vw, 1400px);
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 18px;
    box-shadow: var(--zc-shadow-lg);
}

.zc-image-preview__close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: var(--zc-white-soft);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.zc-image-preview__close:hover {
    background: var(--zc-accent-strong);
}

.zc-image-preview__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.58);
    color: #fff;
    font-size: 42px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.zc-image-preview__nav:hover {
    background: rgba(0, 0, 0, 0.76);
}

.zc-image-preview__nav--prev {
    left: 28px;
}

.zc-image-preview__nav--next {
    right: 28px;
}

.zc-image-preview__counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 13px;
    z-index: 2;
}

.zc-message__content img.zc-emoji {
    width: 22px;
    height: 22px;
    vertical-align: middle;
    margin: 0 1px;
}

.zc-message__content .zc-code-block {
    background: var(--zc-bg-tertiary);
    border: 1px solid var(--zc-border);
    border-radius: var(--zc-radius-sm);
    padding: 8px 12px;
    margin: 4px 0;
    overflow-x: auto;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
    line-height: 1.4;
}

.zc-message__content .zc-code-inline {
    background: var(--zc-bg-tertiary);
    border-radius: 3px;
    padding: 1px 4px;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 13px;
}

.zc-message__content .zc-mention {
    color: var(--zc-primary);
    background: var(--zc-accent-soft);
    border-radius: 3px;
    padding: 0 2px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}

.zc-message__content .zc-mention:hover {
    background: rgba(88, 101, 242, 0.3);
    text-decoration: underline;
}

.zc-message__content .zc-link {
    color: #00a8fc;
    text-decoration: none;
}

.zc-message__content .zc-link:hover {
    text-decoration: underline;
}

.zc-message__content p {
    margin: 0 0 0.75em;
}

.zc-message__content p:last-child {
    margin-bottom: 0;
}

.zc-message__content .zc-md-heading {
    margin: 0.15em 0 0.55em;
    line-height: 1.25;
    color: var(--zc-text-primary);
    font-weight: 800;
}

.zc-message__content .zc-md-heading--1 { font-size: 1.5em; }
.zc-message__content .zc-md-heading--2 { font-size: 1.32em; }
.zc-message__content .zc-md-heading--3 { font-size: 1.18em; }
.zc-message__content .zc-md-heading--4 { font-size: 1.06em; }
.zc-message__content .zc-md-heading--5,
.zc-message__content .zc-md-heading--6 { font-size: 1em; }

.zc-message__content .zc-md-blockquote {
    margin: 0.8em 0;
    padding: 0.8em 1em;
    border-left: 3px solid var(--zc-primary);
    border-radius: 0 14px 14px 0;
    background: color-mix(in srgb, var(--zc-bg-secondary) 72%, transparent);
}

.zc-message__content .zc-md-blockquote > :last-child {
    margin-bottom: 0;
}

.zc-message__content .zc-md-list {
    margin: 0.7em 0;
    padding-left: 1.35em;
}

.zc-message__content .zc-md-list li + li {
    margin-top: 0.35em;
}

.zc-message__content .zc-md-task-item {
    list-style: none;
    margin-left: -0.2em;
}

.zc-message__content .zc-md-task-item label {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.55em;
}

.zc-message__content .zc-md-task-item input[type="checkbox"] {
    margin-top: 0.18em;
}

.zc-message__content .zc-md-hr {
    margin: 1em 0;
    border: 0;
    border-top: 1px solid var(--zc-border);
    opacity: 0.85;
}

.zc-message__content .zc-md-table-wrap {
    width: 100%;
    overflow-x: auto;
    margin: 0.85em 0;
    border: 1px solid var(--zc-border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--zc-bg-secondary) 84%, transparent);
}

.zc-message__content .zc-md-table {
    width: 100%;
    min-width: 320px;
    border-collapse: collapse;
}

.zc-message__content .zc-md-table th,
.zc-message__content .zc-md-table td {
    padding: 0.72em 0.85em;
    border-bottom: 1px solid var(--zc-border);
    text-align: left;
    vertical-align: top;
}

.zc-message__content .zc-md-table th {
    font-weight: 700;
    color: var(--zc-text-primary);
    background: color-mix(in srgb, var(--zc-bg-primary) 42%, transparent);
}

.zc-message__content .zc-md-table tr:last-child td {
    border-bottom: 0;
}

/* Reply reference */
.zc-message__reply {
    font-size: 12px;
    color: var(--zc-text-muted);
    margin-bottom: 4px;
    padding: 2px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.zc-message__reply i {
    font-size: 10px;
}

.zc-message__reply-author {
    font-weight: 600;
    color: var(--zc-text-secondary);
}

.zc-message__reply-text {
    opacity: 0.8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Message actions (hover toolbar) */
.zc-message__actions {
    position: absolute;
    left: calc(100% + 10px);
    top: 24px;
    display: none;
    background: var(--zc-bg-secondary);
    border: 1px solid var(--zc-border);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    overflow: hidden;
    z-index: 2;
}

.zc-message:hover .zc-message__actions {
    display: flex;
}

.zc-message--mine .zc-message__actions {
    left: auto;
    right: calc(100% + 10px);
}

.zc-msg-action {
    background: none;
    border: none;
    color: var(--zc-text-muted);
    width: 30px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.1s, color 0.1s;
}

.zc-msg-action:hover {
    background: var(--zc-hover);
    color: var(--zc-text-primary);
}

/* Pinned message style */
.zc-message--pinned {
    border-left: 2px solid var(--zc-warning);
    padding-left: 14px;
}

/* System message style */
.zc-message--system {
    justify-content: center;
    padding: 8px 16px;
}

.zc-message--system .zc-message__content {
    font-size: 13px;
    color: var(--zc-text-muted);
    font-style: italic;
    text-align: center;
}

/* Scroll to bottom button */
.zc-scroll-bottom {
    position: absolute;
    bottom: 8px;
    right: 16px;
    z-index: 10;
}

.zc-scroll-bottom .zc-btn--circle {
    position: relative;
}

/* ─── Reply Bar ────────────────────────────────────────── */
.zc-reply-bar {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--zc-bg-secondary);
    border-top: 1px solid var(--zc-border);
    font-size: 13px;
    color: var(--zc-text-secondary);
}

.zc-reply-bar__content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
}

.zc-reply-bar__preview {
    opacity: 0.7;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Input Area ───────────────────────────────────────── */
.zc-input-area {
    padding: 10px 16px calc(16px + var(--zc-safe-bottom));
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
    background: var(--zc-bg-primary);
    border-top: 1px solid var(--zc-border);
    position: relative;
    z-index: 3;
}

.zc-pending-images {
    flex: 0 0 100%;
    padding: 8px;
    border: 1px solid var(--zc-border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--zc-bg-secondary) 86%, transparent);
}

.zc-pending-images__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--zc-text-muted);
    font-size: 12px;
}

.zc-pending-images__clear {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--zc-primary);
    cursor: pointer;
    font-size: 12px;
}

.zc-pending-images__list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.zc-pending-images__item {
    position: relative;
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--zc-bg-tertiary);
}

.zc-pending-images__item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.zc-pending-images__remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.66);
    color: #fff;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
}

.zc-input-area__tools {
    flex-shrink: 0;
    padding-bottom: 4px;
}

.zc-input-area__tools .zc-hidden-file-input {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    pointer-events: none !important;
}

.zc-input-area__field {
    flex: 1;
    min-width: 0;
    position: relative;
}

.zc-input-area__meta {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 11px;
    color: var(--zc-text-muted);
}

.zc-input-area__hint {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zc-input-area__count {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.zc-input-area__count.is-warning {
    color: var(--zc-warning);
}

.zc-chat-header__actions .zc-btn-icon {
    position: relative;
}

.zc-usercard__footer {
    display: flex;
    gap: 8px;
}

.zc-usercard__footer > * {
    flex: 1;
}

.zc-textarea {
    width: 100%;
    resize: none;
    border: none;
    background: var(--zc-bg-secondary);
    color: var(--zc-text-primary);
    border-radius: var(--zc-radius);
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    max-height: 200px;
    overflow-y: auto;
    outline: none;
}

.zc-textarea::placeholder {
    color: var(--zc-text-muted);
}

.zc-textarea:focus {
    box-shadow: 0 0 0 1px var(--zc-primary);
}

.zc-input-area__send {
    flex-shrink: 0;
    padding-bottom: 24px;
}

.zc-input-area__login {
    flex: 1;
    text-align: center;
    padding: 12px;
    background: var(--zc-bg-secondary);
    border-radius: var(--zc-radius);
}

.zc-input-area__login a {
    color: var(--zc-primary);
    text-decoration: none;
}

.zc-input-area__login a:hover {
    text-decoration: underline;
}

.zc-chat-main.zc-upload-dragover .zc-messages,
.zc-input-area.zc-upload-dragover,
#zc-dm-panel.zc-upload-dragover .zc-dm-messages,
.zc-dm-compose.zc-upload-dragover {
    box-shadow: inset 0 0 0 2px var(--zc-primary);
    background: rgba(91, 141, 239, 0.08);
}

.zc-chat-main.zc-upload-dragover .zc-messages::after,
#zc-dm-panel.zc-upload-dragover .zc-dm-messages::after {
    content: '松开以上传文件';
    position: sticky;
    bottom: 16px;
    display: block;
    width: fit-content;
    margin: 0 auto;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--zc-primary);
    color: #fff;
    font-size: 13px;
    box-shadow: var(--zc-shadow-md);
    pointer-events: none;
    z-index: 5;
}

/* ─── Right Members Sidebar ────────────────────────────── */
.zc-members {
    width: var(--zc-members-width);
    min-width: var(--zc-members-width);
    background: var(--zc-bg-secondary);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--zc-border);
}

.zc-members__header {
    height: var(--zc-header-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--zc-border);
    flex-shrink: 0;
}

.zc-members__header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--zc-text-primary);
}

.zc-members__list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* Member group */
.zc-member-group__title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--zc-text-muted);
    padding: 12px 8px 4px;
    margin: 0;
    letter-spacing: 0.02em;
}

/* Member item */
.zc-member-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: var(--zc-radius-sm);
    cursor: pointer;
    transition: background 0.1s;
}

.zc-member-item:hover {
    background: var(--zc-hover);
}

.zc-member-item__avatar {
    position: relative;
    flex-shrink: 0;
    margin-right: 10px;
}

.zc-member-item__avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: block;
}

.zc-member-item__name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--zc-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Role badges for owner/manager */
.zc-member-role-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.zc-member-role-badge--owner {
    background: linear-gradient(135deg, #f0b232 0%, #e6a820 100%);
    color: #1a1a1a;
}

.zc-member-role-badge--manager {
    background: linear-gradient(135deg, #5865f2 0%, #4752c4 100%);
    color: #ffffff;
}

.zc-member-role-badge--staff {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
}

/* Offline members are dimmed */
.zc-member-group[data-status="offline"] .zc-member-item__avatar img {
    opacity: 0.5;
}
.zc-member-group[data-status="offline"] .zc-member-item__name {
    opacity: 0.5;
}

/* ─── Pinned Bar ───────────────────────────────────────── */
.zc-pinned-bar {
    padding: 0 12px 0 0;
    background: var(--zc-panel-strong);
    border-bottom: 1px solid var(--zc-border);
    border-left: 3px solid var(--zc-warning);
    display: flex;
    align-items: stretch;
    font-size: 13px;
    color: var(--zc-text-secondary);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    z-index: 10;
}

.zc-pinned-bar:hover {
    background: var(--zc-panel-strong-hover);
}

.zc-pinned-bar__content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    padding: 7px 10px;
    min-width: 0;
}

.zc-pinned-bar__content > i.fa-thumb-tack {
    color: var(--zc-warning);
    flex-shrink: 0;
    font-size: 12px;
}

#zc-pinned-count {
    background: var(--zc-warning);
    color: #1a1a1a;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
    line-height: 1.4;
    flex-shrink: 0;
}

#zc-pinned-text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
    line-height: 1.4;
}

#zc-pinned-text strong {
    color: var(--zc-text-primary);
    font-weight: 600;
    margin-right: 4px;
}

#zc-pinned-view-all {
    flex-shrink: 0;
    color: var(--zc-text-muted);
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    border-left: 1px solid var(--zc-border);
    transition: background 0.15s, color 0.15s;
}

#zc-pinned-view-all:hover {
    color: var(--zc-text-primary);
    background: var(--zc-hover);
}

/* ─── Pinned Panel ────────────────────────────────────── */
.zc-pinned-panel {
    background: var(--zc-bg-secondary);
    border-bottom: 2px solid var(--zc-warning);
    box-shadow: 0 6px 24px rgba(0,0,0,0.22);
    max-height: 360px;
    display: flex;
    flex-direction: column;
    animation: zc-slide-down 0.18s ease;
    overflow: hidden;
}

@keyframes zc-slide-down {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.zc-pinned-panel__header {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--zc-border);
    flex-shrink: 0;
    background: var(--zc-bg-tertiary);
}

.zc-pinned-panel__header h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--zc-text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.zc-pinned-panel__header h4 i {
    color: var(--zc-warning);
    font-size: 12px;
}

.zc-pinned-panel__list {
    padding: 10px 12px;
    overflow-y: auto;
    flex: 1;
}

/* Compact pinned item */
.zc-pinned-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--zc-white-faint), transparent);
    border: 1px solid var(--zc-border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.zc-pinned-item:hover {
    background: var(--zc-hover);
    border-color: color-mix(in srgb, var(--zc-warning) 35%, var(--zc-border));
    transform: translateY(-1px);
}

.zc-pinned-item:last-child {
    margin-bottom: 0;
}

.zc-pinned-item__icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(240, 178, 50, 0.14);
    color: var(--zc-warning);
    font-size: 11px;
    flex-shrink: 0;
    margin-top: 1px;
}

.zc-pinned-item__main {
    min-width: 0;
    flex: 1;
}

.zc-pinned-item__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.zc-pinned-item__author {
    color: var(--zc-text-primary);
    font-weight: 700;
    font-size: 12px;
    max-width: 160px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.zc-pinned-item__time {
    color: var(--zc-text-muted);
    font-size: 11px;
    flex-shrink: 0;
}

.zc-pinned-item__text {
    color: var(--zc-text-secondary);
    font-size: 13px;
    line-height: 1.45;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Unpin button inside panel */
.zc-pinned-unpin {
    margin-left: auto;
    color: var(--zc-text-muted);
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 11px;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.zc-pinned-unpin:hover {
    background: var(--zc-danger);
    color: #fff;
}

.zc-message--jump-highlight {
    animation: zc-message-jump-highlight 1.8s ease;
}

@keyframes zc-message-jump-highlight {
    0% {
        background: rgba(240, 178, 50, 0.28);
        box-shadow: inset 3px 0 0 var(--zc-warning);
    }
    60% {
        background: rgba(240, 178, 50, 0.18);
        box-shadow: inset 3px 0 0 var(--zc-warning);
    }
    100% {
        background: transparent;
        box-shadow: inset 0 0 0 transparent;
    }
}

/* ─── Search Panel ─────────────────────────────────────── */
.zc-search-panel {
    position: absolute;
    top: calc(var(--zc-theme-offset, 0px) + var(--zc-header-height));
    right: 0;
    width: 420px;
    max-width: 100%;
    height: calc(100% - var(--zc-header-height) - var(--zc-theme-offset, 0px));
    background: var(--zc-bg-secondary);
    border-left: 1px solid var(--zc-border);
    display: flex;
    flex-direction: column;
    z-index: 20;
    box-shadow: -4px 0 16px rgba(0,0,0,0.2);
}

.zc-search-panel__input-wrap {
    display: flex;
    padding: 12px;
    gap: 8px;
    border-bottom: 1px solid var(--zc-border);
}

.zc-search-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.zc-mentions-panel {
    position: absolute;
    top: calc(var(--zc-header-height) + 8px);
    right: 16px;
    width: 360px;
    max-width: calc(100% - 32px);
    max-height: min(70vh, 560px);
    background: var(--zc-bg-secondary);
    border: 1px solid var(--zc-border);
    border-radius: 16px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
    z-index: 32;
    overflow: hidden;
}

.zc-mentions-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--zc-border);
}

.zc-mentions-panel__header h4 {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.zc-mentions-list {
    display: flex;
    flex-direction: column;
    max-height: calc(min(70vh, 560px) - 60px);
    overflow-y: auto;
    padding: 10px;
    gap: 8px;
}

.zc-mentions-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--zc-border);
    border-radius: 14px;
    background: var(--zc-bg-tertiary);
    color: var(--zc-text-primary);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.zc-mentions-item:hover {
    border-color: var(--zc-primary);
    transform: translateY(-1px);
}

.zc-mentions-item__avatar img {
    width: 34px;
    height: 34px;
    display: block;
    border-radius: 50%;
}

.zc-mentions-item__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.zc-mentions-item__top {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.zc-mentions-item__top strong {
    font-size: 14px;
    line-height: 1.3;
}

.zc-mentions-item__top small,
.zc-mentions-item__preview {
    color: var(--zc-text-muted);
    font-size: 12px;
    line-height: 1.5;
}

/* ─── Connection Status ────────────────────────────────── */
.zc-connection-status {
    padding: 6px 16px;
    background: var(--zc-danger);
    color: #fff;
    font-size: 13px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
}

/* ─── Common UI Elements ───────────────────────────────── */
.zc-input {
    width: 100%;
    background: var(--zc-bg-tertiary);
    border: 1px solid var(--zc-border);
    color: var(--zc-text-primary);
    border-radius: var(--zc-radius-sm);
    padding: 6px 10px;
    font-size: 13px;
    outline: none;
}

.zc-input:focus {
    border-color: var(--zc-primary);
}

.zc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: var(--zc-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    text-decoration: none;
    gap: 6px;
}

.zc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.zc-btn--primary {
    background: var(--zc-primary);
    color: #fff;
}

.zc-btn--primary:hover:not(:disabled) {
    background: var(--zc-primary-hover);
}

.zc-btn--soft {
    background: color-mix(in srgb, var(--zc-active) 72%, transparent);
    color: var(--zc-text-primary);
    border: 1px solid var(--zc-border);
}

.zc-btn--soft:hover:not(:disabled) {
    background: color-mix(in srgb, var(--zc-hover) 82%, transparent);
}

.zc-btn--text {
    background: transparent;
    color: var(--zc-text-secondary);
}

.zc-btn--text:hover {
    background: var(--zc-hover);
    color: var(--zc-text-primary);
}

.zc-btn--small {
    padding: 4px 10px;
    font-size: 12px;
}

.zc-btn--circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    padding: 0;
    background: var(--zc-bg-secondary);
    color: var(--zc-text-secondary);
    border: 1px solid var(--zc-border);
}

.zc-btn--circle:hover {
    background: var(--zc-hover);
    color: var(--zc-text-primary);
}

.zc-btn-icon {
    background: none;
    border: none;
    color: var(--zc-text-muted);
    font-size: 16px;
    padding: 6px;
    cursor: pointer;
    border-radius: var(--zc-radius-sm);
    transition: color 0.15s, background 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.zc-btn-icon:hover {
    color: var(--zc-text-primary);
    background: var(--zc-hover);
}

/* Badge count */
.zc-badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--zc-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 4px;
}

/* VIP Badge */
.zc-badge--vip {
    background: linear-gradient(135deg, #f0b232, #f57c00);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 2px;
}

/* User Card */
.zc-usercard {
    position: fixed;
    z-index: 100;
    width: 300px;
    background: var(--zc-bg-secondary);
    border: 1px solid var(--zc-border);
    border-radius: var(--zc-radius);
    box-shadow: var(--zc-shadow-md);
    overflow: hidden;
}

.zc-usercard__header {
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--zc-bg-tertiary);
}

.zc-usercard__avatar img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
}

.zc-usercard__name {
    font-size: 16px;
    font-weight: 700;
    color: var(--zc-text-primary);
    display: block;
}

.zc-usercard__body {
    padding: 12px 16px;
}

.zc-usercard__footer {
    padding: 8px 16px 12px;
    text-align: center;
}

/* Context Menu */
.zc-context-menu {
    position: absolute;
    z-index: 50;
    background: var(--zc-bg-secondary);
    border: 1px solid var(--zc-border);
    border-radius: var(--zc-radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    min-width: 180px;
    padding: 4px;
}

.zc-context-menu__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.zc-context-menu__item {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: var(--zc-radius-sm);
    font-size: 13px;
    color: var(--zc-text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.1s;
}

.zc-context-menu__item:hover {
    background: var(--zc-primary);
    color: #fff;
}

.zc-context-menu__item--danger:hover {
    background: var(--zc-danger);
}

/* Emoji picker */
.zc-emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 16px;
    width: 360px;
    max-height: 320px;
    background: var(--zc-bg-secondary);
    border: 1px solid var(--zc-border);
    border-radius: var(--zc-radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    z-index: 30;
    display: flex;
    flex-direction: column;
}

.zc-emoji-picker__tabs {
    display: flex;
    padding: 6px;
    gap: 4px;
    border-bottom: 1px solid var(--zc-border);
    flex-shrink: 0;
    overflow-x: auto;
}

.zc-emoji-picker__grid {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.zc-emoji-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--zc-radius-sm);
    transition: background 0.1s;
}

.zc-emoji-item:hover {
    background: var(--zc-hover);
}

.zc-emoji-item img {
    width: 28px;
    height: 28px;
}

/* Loading spinner */
.zc-loading {
    text-align: center;
    padding: 24px;
    color: var(--zc-text-muted);
}

.zc-loading__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--zc-border);
    border-top-color: var(--zc-primary);
    border-radius: 50%;
    animation: zc-spin 0.8s linear infinite;
    margin: 0 auto 8px;
}

.zc-empty-state {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 32px 20px;
    text-align: center;
    color: var(--zc-text-secondary);
}

.zc-empty-state__icon {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--zc-bg-secondary) 82%, #ffffff 18%);
    color: var(--zc-text-muted);
    font-size: 22px;
}

.zc-empty-state__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--zc-text-primary);
}

.zc-empty-state__desc {
    max-width: 320px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--zc-text-muted);
}

.zc-empty-state__actions .zc-btn {
    min-width: 180px;
}

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

/* Login prompt */
.zc-login-prompt {
    text-align: center;
    padding: 4px;
}

.zc-login-prompt .zc-btn {
    width: 100%;
}

/* Mobile overlay */
.zc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 40;
}

/* Mobile-only elements (hidden on desktop) */
.zc-mobile-only {
    display: none;
}

/* ─── Scrollbar ────────────────────────────────────────── */
.zc-messages::-webkit-scrollbar,
.zc-channel-list::-webkit-scrollbar,
.zc-members__list::-webkit-scrollbar {
    width: 6px;
}

.zc-messages::-webkit-scrollbar-thumb,
.zc-channel-list::-webkit-scrollbar-thumb,
.zc-members__list::-webkit-scrollbar-thumb {
    background: var(--zc-border);
    border-radius: 3px;
}

.zc-messages::-webkit-scrollbar-track,
.zc-channel-list::-webkit-scrollbar-track,
.zc-members__list::-webkit-scrollbar-track {
    background: transparent;
}

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 1280px) {
    .zc-members {
        width: 200px;
        min-width: 200px;
    }
}

@media (max-width: 1180px) {
    .zc-members {
        display: none;
        position: fixed;
        right: 0;
        top: var(--zc-theme-offset, 0px);
        bottom: 0;
        width: var(--zc-members-width);
        z-index: 50;
    }
    .zc-members.zc-members--open {
        display: flex;
    }
    .zc-mobile-only {
        display: inline-flex;
    }
}

@media (max-width: 768px) {
    .zc-page,
    .zc-app {
        min-height: 100dvh;
        height: 100dvh;
    }
    .zc-notice-ticker-wrap {
        padding: 8px 10px 0;
    }
    .zc-notice-ticker {
        min-height: 36px;
        gap: 10px;
        padding: 0 10px;
    }
    .zc-notice-ticker__badge {
        padding: 5px 9px;
        font-size: 11px;
    }
    .zc-notice-ticker__item {
        font-size: 12px;
    }
    .zc-sidebar {
        display: none;
        position: fixed;
        left: 0;
        top: var(--zc-theme-offset, 0px);
        bottom: 0;
        width: var(--zc-sidebar-width);
        z-index: 50;
    }
    .zc-sidebar.zc-sidebar--open {
        display: flex;
    }
    .zc-search-panel {
        top: calc(var(--zc-theme-offset, 0px) + var(--zc-header-height));
        width: 100%;
        height: calc(100% - var(--zc-header-height) - var(--zc-theme-offset, 0px));
    }
    .zc-mentions-panel {
        top: calc(var(--zc-theme-offset, 0px) + 56px);
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        max-height: calc(100dvh - var(--zc-theme-offset, 0px) - 72px);
    }
    .zc-emoji-picker {
        width: calc(100vw - 32px);
        left: 16px;
    }
    .zc-chat-header {
        padding: 0 12px;
    }
    .zc-messages__list {
        padding: 12px;
        padding-bottom: 18px;
    }
    .zc-input-area {
        padding: 10px 12px calc(12px + var(--zc-safe-bottom));
        gap: 6px;
    }
    .zc-input-area__send {
        padding-bottom: 22px;
    }
    .zc-input-area__hint {
        max-width: 60%;
    }
    .zc-textarea {
        padding: 10px 12px;
    }
    .zc-dm-panel {
        top: var(--zc-theme-offset, 0px);
        right: 0;
        bottom: 0;
        width: 100vw;
        border-radius: 0;
    }
    .zc-dm-panel__sidebar {
        width: 38%;
        min-width: 140px;
    }
    .zc-dm-messages {
        padding: 12px;
    }
    .zc-dm-compose {
        padding: 10px 12px calc(10px + var(--zc-safe-bottom));
    }
    .zc-dm-message {
        max-width: 96%;
    }
}

@media (max-width: 520px) {
    .zc-chat-header__desc,
    .zc-input-area__hint {
        display: none;
    }
    .zc-chat-header__actions {
        gap: 2px;
    }
    .zc-input-area {
        align-items: stretch;
        flex-wrap: wrap;
    }
    .zc-input-area__tools {
        order: 2;
        display: flex;
        gap: 4px;
        width: calc(100% - 52px);
        padding-bottom: 0;
    }
    .zc-input-area__field {
        order: 1;
        flex: 0 0 100%;
    }
    .zc-input-area__send {
        order: 3;
        margin-left: auto;
        padding-bottom: 0;
    }
    .zc-input-area__meta {
        justify-content: flex-end;
    }
}

/* ─── Toast Notifications ──────────────────────────────── */
.zc-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 20px;
    border-radius: var(--zc-radius);
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--zc-shadow-md);
}

.zc-toast--show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.zc-toast--info {
    background: var(--zc-primary);
}

.zc-toast--error {
    background: var(--zc-danger);
}

.zc-toast--success {
    background: var(--zc-success);
}

/* ─── @Mention Dropdown ────────────────────────────────── */
.zc-mention-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 10px);
    background: var(--zc-bg-secondary);
    border: 1px solid var(--zc-border);
    border-radius: 16px;
    box-shadow: var(--zc-shadow-md);
    max-height: 260px;
    overflow-y: auto;
    min-width: 240px;
    z-index: 35;
}

.zc-mention-dropdown__item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    gap: 10px;
    cursor: pointer;
    border: 0;
    background: transparent;
    text-align: left;
    font-size: 13px;
    color: var(--zc-text-primary);
    transition: background 0.1s;
}

.zc-mention-dropdown__item:hover,
.zc-mention-dropdown__item.is-active {
    background: var(--zc-hover);
}

.zc-mention-dropdown__avatar-wrap {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.zc-mention-dropdown__avatar,
.zc-mention-dropdown__avatar-wrap img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: block;
}

.zc-mention-dropdown__avatar--all {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    color: #fff;
    font-size: 14px;
    box-shadow: 0 10px 18px rgba(234, 88, 12, 0.24);
}

.zc-mention-dropdown__avatar--ai {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
    color: #fff;
    font-size: 14px;
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.24);
}

.zc-mention-dropdown__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.zc-mention-dropdown__meta strong {
    font-size: 13px;
    color: var(--zc-text-primary);
}

.zc-mention-dropdown__meta small {
    font-size: 11px;
    color: var(--zc-text-muted);
}

.zc-mention--all {
    background: color-mix(in srgb, #f59e0b 18%, transparent);
    color: #fbbf24;
}

/* ─── Message State Modifiers ──────────────────────────── */
.zc-message--highlight {
    animation: zc-highlight 2s ease-out;
}

@keyframes zc-highlight {
    0%  { background: rgba(88, 101, 242, 0.3); }
    100% { background: transparent; }
}

.zc-message--editing {
    background: rgba(88, 101, 242, 0.1) !important;
    border-left: 3px solid var(--zc-primary);
}

/* ─── Pinned Message (in main list) ─────────────────── */
.zc-message--pinned {
    background: var(--zc-panel-strong);
    border-left: 3px solid var(--zc-warning);
}

.zc-message__pinned-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 1px 6px;
    background: rgba(255, 193, 7, 0.15);
    color: var(--zc-warning);
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

.zc-message__pinned-badge i {
    font-size: 10px;
}

/* ─── Input Area Disabled ──────────────────────────────── */
.zc-input-area--disabled {
    opacity: 0.6;
    pointer-events: none;
}

.zc-input-area--disabled .zc-textarea {
    background: var(--zc-bg-tertiary);
    cursor: not-allowed;
}

/* ─── Channel Group Collapsed ──────────────────────────── */
.zc-channel-group--collapsed .zc-channel-group__items {
    display: none;
}

/* ─── Emoji Panel (inside picker grid) ─────────────────── */
.zc-emoji-panel {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.zc-emoji-tab {
    background: transparent;
    border: none;
    color: var(--zc-text-muted);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: var(--zc-radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.zc-emoji-tab:hover {
    background: var(--zc-hover);
    color: var(--zc-text-primary);
}

.zc-emoji-tab--active {
    background: var(--zc-primary);
    color: #fff;
}

/* ─── Context Menu (li elements) ───────────────────────── */
.zc-context-menu__list li {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: var(--zc-radius-sm);
    font-size: 13px;
    color: var(--zc-text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.1s;
    list-style: none;
}

.zc-context-menu__list li:hover {
    background: var(--zc-primary);
    color: #fff;
}

.zc-context-menu__list li.zc-context-menu__danger:hover {
    background: var(--zc-danger);
}

/* ─── Search Results ───────────────────────────────────── */
.zc-search-results__empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--zc-text-muted);
}

.zc-search-results__empty i {
    font-size: 36px;
    display: block;
    margin-bottom: 12px;
}

.zc-search-results__header {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--zc-text-muted);
    padding: 8px 4px;
    letter-spacing: 0.02em;
}

.zc-search-result-item {
    cursor: pointer;
    border-radius: var(--zc-radius-sm);
    margin-bottom: 2px;
    transition: background 0.1s;
}

.zc-search-result-item:hover {
    background: var(--zc-hover);
}

.zc-search-results__pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    font-size: 13px;
    color: var(--zc-text-muted);
}

/* ─── Direct Messages ───────────────────────────────────── */
.zc-dm-panel {
    position: fixed;
    top: calc(var(--zc-theme-offset, 0px) + 16px);
    right: 16px;
    bottom: 16px;
    width: min(860px, calc(100vw - 32px));
    display: flex;
    background: var(--zc-bg-secondary);
    border: 1px solid var(--zc-border);
    border-radius: 16px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    z-index: 1010;
}

.zc-dm-panel__sidebar {
    width: 300px;
    min-width: 300px;
    border-right: 1px solid var(--zc-border);
    display: flex;
    flex-direction: column;
    background: var(--zc-bg-tertiary);
}

.zc-dm-panel__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--zc-bg-primary);
}

.zc-dm-panel__header,
.zc-dm-thread__header {
    height: 56px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--zc-border);
    flex-shrink: 0;
}

.zc-dm-panel__header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.zc-dm-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.zc-dm-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.zc-dm-list-item:hover,
.zc-dm-list-item--active {
    background: var(--zc-hover);
}

.zc-dm-list-item__avatar {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.zc-dm-list-item__avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: block;
}

.zc-dm-list-item__body {
    flex: 1;
    min-width: 0;
}

.zc-dm-list-item__top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zc-dm-list-item__name {
    font-weight: 600;
    color: var(--zc-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zc-dm-list-item__time {
    font-size: 11px;
    color: var(--zc-text-muted);
    margin-left: auto;
    flex-shrink: 0;
}

.zc-dm-list-item__preview {
    margin-top: 2px;
    font-size: 12px;
    color: var(--zc-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zc-dm-list-item__unread {
    margin-left: auto;
    flex-shrink: 0;
}

.zc-dm-empty {
    margin: auto;
    text-align: center;
    color: var(--zc-text-muted);
    padding: 24px;
}

.zc-dm-empty i {
    font-size: 42px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.7;
}

.zc-dm-thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.zc-dm-thread__user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.zc-dm-thread__avatar {
    width: 40px;
    height: 40px;
    overflow: hidden;
    border-radius: 50%;
    flex-shrink: 0;
}

.zc-dm-thread__avatar img {
    width: 40px;
    height: 40px;
    display: block;
    border-radius: 50%;
}

.zc-dm-thread__meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.zc-dm-thread__status {
    font-size: 12px;
    color: var(--zc-text-muted);
}

.zc-dm-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
}

.zc-dm-messages__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.zc-dm-history-loader {
    text-align: center;
    margin-bottom: 12px;
}

.zc-dm-message {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    max-width: 88%;
}

.zc-dm-message--mine {
    margin-left: auto;
    justify-content: flex-end;
}

.zc-dm-message__avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.zc-dm-message__avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: block;
}

.zc-dm-message__bubble-wrap {
    min-width: 0;
    position: relative;
}

.zc-dm-message__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.zc-dm-message--mine .zc-dm-message__meta {
    justify-content: flex-end;
}

.zc-dm-message__author {
    font-size: 12px;
    color: var(--zc-text-muted);
}

.zc-dm-message__time {
    font-size: 11px;
    color: var(--zc-text-muted);
}

.zc-dm-message__read-state {
    font-size: 11px;
    color: var(--zc-text-muted);
}

.zc-dm-message__bubble {
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--zc-bg-secondary);
    color: var(--zc-text-primary);
    word-break: break-word;
    line-height: 1.45;
}

.zc-dm-message--mine .zc-dm-message__bubble {
    background: var(--zc-primary);
    color: #fff;
}

.zc-dm-message__reply {
    display: flex;
    gap: 6px;
    align-items: center;
    max-width: 260px;
    margin: 0 0 6px;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.14);
    color: var(--zc-text-muted);
    font-size: 12px;
    line-height: 1.25;
}

.zc-dm-message--mine .zc-dm-message__reply {
    margin-left: auto;
    background: rgba(99, 102, 241, 0.18);
}

.zc-dm-message__reply-author {
    flex-shrink: 0;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zc-dm-message__reply-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zc-dm-message__actions {
    display: none;
    gap: 5px;
    margin-top: 4px;
    opacity: 0;
    transition: opacity .15s ease;
}

.zc-dm-message:hover .zc-dm-message__actions {
    opacity: 1;
}

.zc-dm-message--mine .zc-dm-message__actions {
    justify-content: flex-end;
}

.zc-dm-action {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 999px;
    background: var(--zc-bg-secondary);
    color: var(--zc-text-muted);
    cursor: pointer;
}

.zc-dm-action:hover {
    color: var(--zc-primary);
}

.zc-dm-action--danger:hover {
    color: #ef4444;
}

.zc-dm-message--recalled .zc-dm-message__bubble {
    color: var(--zc-text-muted);
    background: var(--zc-bg-secondary);
    font-style: italic;
}

.zc-dm-reply-preview {
    margin: -4px -4px 8px;
    border-radius: 10px;
}

.zc-dm-reply-preview .zc-reply-bar__content {
    gap: 5px;
}

.zc-dm-reply-preview .zc-reply-bar__preview {
    margin-left: 4px;
}

.zc-dm-reply-cancel {
    flex-shrink: 0;
}

.zc-dm-compose {
    padding: 12px 16px calc(12px + var(--zc-safe-bottom));
    border-top: 1px solid var(--zc-border);
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.zc-dm-compose__tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding-bottom: 4px;
}

.zc-dm-compose .zc-textarea {
    min-height: 44px;
}

.zc-front-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(7, 10, 16, 0.58);
    backdrop-filter: blur(10px);
}

.zc-front-modal {
    width: min(100%, 520px);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(36, 40, 48, 0.98) 0%, rgba(26, 29, 35, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    color: #f3f6fb;
    overflow: hidden;
}

.zc-front-modal--compact {
    width: min(100%, 460px);
}

.zc-front-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 24px 16px;
}

.zc-front-modal__title {
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
    font-weight: 800;
    color: #ffffff;
}

.zc-front-modal__desc {
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 1.7;
    color: rgba(222, 229, 238, 0.72);
}

.zc-front-modal__close {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.82);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s ease;
}

.zc-front-modal__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.zc-front-modal__body {
    padding: 0 24px 20px;
}

.zc-front-modal__field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.zc-front-modal__label {
    font-size: 13px;
    font-weight: 700;
    color: rgba(244, 247, 252, 0.92);
}

.zc-front-modal__input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(9, 12, 18, 0.34);
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.zc-front-modal__input:focus {
    border-color: rgba(82, 145, 255, 0.8);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
}

.zc-front-modal__hint {
    font-size: 12px;
    line-height: 1.6;
    color: rgba(205, 214, 226, 0.62);
}

.zc-front-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 24px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

/* ─── Messages Empty State ─────────────────────────────── */
.zc-messages__empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--zc-text-muted);
}

.zc-messages__empty i {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ─── Small Spinner ────────────────────────────────────── */
.zc-loading__spinner--small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* ─── Channel Badges (inline) ──────────────────────────── */
.zc-channel-item .zc-badge-count {
    position: static;
    flex-shrink: 0;
    margin-left: auto;
}

/* ─── Reply Bar Styles ─────────────────────────────────── */
.zc-reply-bar {
    padding: 8px 16px;
    background: var(--zc-bg-secondary);
    border-top: 1px solid var(--zc-border);
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--zc-text-secondary);
}

.zc-reply-bar__content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
}

.zc-reply-bar__content i {
    color: var(--zc-primary);
}

.zc-reply-bar__preview {
    color: var(--zc-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-left: 4px;
}

/* ─── Scroll Bottom Button ─────────────────────────────── */
.zc-scroll-bottom {
    position: absolute;
    bottom: calc(92px + var(--zc-safe-bottom));
    right: 20px;
    z-index: 10;
}

/* ─── Status Dots ──────────────────────────────────────── */
.zc-member-item__avatar .zc-status-dot {
    border-color: var(--zc-bg-secondary);
}

/* ─── User Card Detail Rows ────────────────────────────── */
.zc-usercard__row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
    color: var(--zc-text-secondary);
}

.zc-usercard__row span:first-child {
    color: var(--zc-text-muted);
}

/* ─── Theme Mobile Elements Hide ────────────────────────── */
.zc-page .footer,
.zc-page .float-btn,
.zc-page .zib-toolbar,
.zc-page .scroll-top,
.zc-page .mobile-bottom-nav,
.zc-page .mobile-bottom-menu,
.zc-page .zib-mobile-nav,
.zc-page .zib-bottom-nav,
.zc-page .bottom-nav-bar,
.zc-page .mobile-footer,
.zc-page .nav-bottom,
.zc-page .zib-nav-bottom,
.zc-page .zibll-mobile-nav,
.zc-page .zibll-bottom-nav,
.zc-page .zib-toolbar-bottom,
.zc-page .fixed-bottom-bar,
.zc-page .footer-tabbar,
.zc-page .float-right {
    display: none !important;
}

@media (max-width: 768px) {
    .zc-page {
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    .zc-page.zc-with-theme-header {
        --zc-theme-offset: 56px;
    }

    .zc-page .container,
    .zc-page .wrap,
    .zc-page .site-content,
    .zc-page #content {
        margin: 0;
        padding: 0;
        max-width: none;
        width: 100%;
    }
    
    .zc-page body {
        margin: 0;
        padding: 0;
        overflow: hidden;
    }
}

.zc-usercard__role {
    background: var(--zc-primary);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.zc-usercard__badges {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.zc-usercard__avatar {
    position: relative;
}

.zc-usercard__avatar .zc-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
}

/* ─── Hashtag / Topic Tags ────────────────────────────────── */
.zc-tag {
    color: var(--zc-primary) !important;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}

.zc-tag:hover {
    text-decoration: underline;
}

/* ─── Poll Card ──────────────────────────────────────────── */
.zc-poll {
    background: var(--zc-bg-tertiary);
    border-radius: var(--zc-radius);
    padding: 12px 14px;
    max-width: 420px;
    margin-top: 4px;
}

.zc-poll__question {
    font-weight: 600;
    font-size: 14px;
    color: var(--zc-text-primary);
    margin-bottom: 6px;
}

.zc-poll__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--zc-text-muted);
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.zc-poll__tag {
    background: var(--zc-primary);
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
}

.zc-poll__options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.zc-poll__option {
    position: relative;
    padding: 8px 12px;
    border-radius: var(--zc-radius-sm);
    background: var(--zc-bg-secondary);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: background 0.15s;
    min-height: 36px;
}

.zc-poll__option:hover {
    background: var(--zc-hover);
}

.zc-poll__option--voted {
    border: 1px solid var(--zc-primary);
}

.zc-poll__option-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--zc-primary);
    opacity: 0.15;
    border-radius: var(--zc-radius-sm);
    transition: width 0.3s ease;
}

.zc-poll__option-text {
    position: relative;
    z-index: 1;
    flex: 1;
    font-size: 13px;
    color: var(--zc-text-primary);
}

.zc-poll__option-pct {
    position: relative;
    z-index: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--zc-text-secondary);
    min-width: 36px;
    text-align: right;
}

.zc-poll__option-cnt {
    position: relative;
    z-index: 1;
    font-size: 11px;
    color: var(--zc-text-muted);
}

.zc-poll__actions {
    margin-top: 8px;
    text-align: right;
}

.zc-poll__close-btn {
    font-size: 12px;
    color: var(--zc-danger) !important;
}

/* Poll creation modal */
.zc-poll-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--zc-bg-secondary);
    border-radius: 12px;
    padding: 24px 28px;
    z-index: 10001;
    width: 440px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    border: 1px solid var(--zc-border);
}

.zc-poll-modal .zc-input {
    padding: 9px 12px;
    background: var(--zc-bg-tertiary);
    border: 1px solid var(--zc-border);
    border-radius: 6px;
    color: var(--zc-text-primary);
    font-size: 14px;
    transition: border-color 0.15s;
}

.zc-poll-modal .zc-input:focus {
    outline: none;
    border-color: var(--zc-primary);
    box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.15);
}

.zc-poll-modal__checks label {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    margin: 0 !important;
    cursor: pointer;
}

.zc-poll-modal__checks input[type=checkbox] {
    margin: 0;
    cursor: pointer;
}

.zc-poll-modal__overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
}

.zc-poll-modal h4 {
    margin: 0 0 16px;
    font-size: 17px;
    font-weight: 600;
    color: var(--zc-text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.zc-poll-modal label {
    display: block;
    font-size: 12px;
    color: var(--zc-text-secondary);
    margin-bottom: 4px;
    margin-top: 10px;
}

.zc-poll-modal .zc-input,
.zc-poll-modal .zc-textarea {
    width: 100%;
    box-sizing: border-box;
}

.zc-poll-modal__options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.zc-poll-modal__add-opt {
    font-size: 12px;
    margin-top: 4px;
}

.zc-poll-modal__checks {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 13px;
    color: var(--zc-text-secondary);
}

.zc-poll-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.zc-poll-modal__footer .zc-btn:not(.zc-btn--primary) {
    background: var(--zc-bg-tertiary);
    color: var(--zc-text-primary);
    border: 1px solid var(--zc-border);
}

.zc-poll-modal h4 {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--zc-border);
}

.zc-poll-modal h4 .fa {
    color: var(--zc-primary);
    margin-right: 6px;
}

.zc-poll-modal,
.zc-confirm-modal {
    animation: zc-modal-in 0.18s ease-out;
}

@keyframes zc-modal-in {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ─── Confirm Modal (custom, replaces native confirm) ────── */
.zc-confirm-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10010;
}

.zc-confirm-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--zc-bg-secondary);
    border-radius: var(--zc-radius);
    padding: 24px;
    z-index: 10011;
    min-width: 320px;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.zc-confirm-modal__body {
    color: var(--zc-text-primary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 18px;
}

.zc-confirm-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.zc-confirm-modal__footer .zc-btn:not(.zc-btn--primary) {
    background: var(--zc-bg-tertiary);
    color: var(--zc-text-primary);
    border: 1px solid var(--zc-border);
}

/* ─── Unread Separator ────────────────────────────────────── */
.zc-unread-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    position: relative;
}

.zc-unread-separator::before,
.zc-unread-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--zc-danger);
    opacity: 0.5;
}

.zc-unread-separator span {
    padding: 0 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--zc-danger);
    white-space: nowrap;
}

/* ─── Typing Indicator ───────────────────────────────────── */
.zc-typing-indicator {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 4px 16px;
    font-size: 12px;
    color: var(--zc-text-muted);
    background: var(--zc-bg-secondary);
    min-height: 24px;
    line-height: 1;
}

.zc-typing-indicator.is-visible {
    display: flex;
}

.zc-typing-indicator__dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.zc-typing-indicator__dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--zc-text-muted);
    animation: zc-typing-bounce 1.4s ease-in-out infinite;
}

.zc-typing-indicator__dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.zc-typing-indicator__dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.zc-typing-indicator__text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

@keyframes zc-typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}
