/* Cold dark / cold light — макеты Family Chat */
:root {
    --fc-accent: #3390ec;
    --fc-radius: 14px;
}

[data-theme="dark"] {
    --fc-bg: #121b22;
    --fc-surface: #1e2732;
    --fc-surface-2: #24303d;
    --fc-text: #f2f5f8;
    --fc-muted: #8b9bab;
    --fc-border: #2a3644;
    --fc-input-bg: #1a222c;
    --fc-logo-f: #ffffff;
    --fc-logo-c: #3390ec;
    /* страница чата */
    --fc-chat-bg: #0e1620;
    --fc-chat-header-bg: #152028;
    --fc-chat-pattern: url("/img/chat-pattern-tile-dark.svg");
    --fc-bubble-in: #263445;
    --fc-bubble-out: #3390ec;
    --fc-bubble-in-text: #f2f5f8;
    --fc-bubble-out-text: #ffffff;
    --fc-bubble-footer-in: rgba(242, 245, 248, 0.55);
    --fc-bubble-footer-out: rgba(255, 255, 255, 0.75);
    --fc-compose-pill-bg: #1a2633;
    --fc-compose-bar-bg: rgba(14, 22, 32, 0.94);
    /* иконка «отправить»: бирюза → синий (как в макетах) */
    --fc-send-glyph-from: #2dd4bf;
    --fc-send-glyph-to: #1d4ed8;
}

[data-theme="light"] {
    --fc-bg: #f4f7fb;
    --fc-surface: #ffffff;
    --fc-surface-2: #eef2f7;
    --fc-text: #0f172a;
    --fc-muted: #64748b;
    --fc-border: #e2e8f0;
    --fc-input-bg: #ffffff;
    --fc-logo-f: #0f172a;
    --fc-logo-c: #3390ec;
    --fc-chat-bg: #c5d2e5;
    --fc-chat-header-bg: #ffffff;
    --fc-chat-pattern: url("/img/chat-pattern-tile.svg");
    --fc-bubble-in: #ffffff;
    --fc-bubble-out: #3390ec;
    --fc-bubble-in-text: #0f172a;
    --fc-bubble-out-text: #ffffff;
    --fc-bubble-footer-in: rgba(15, 23, 42, 0.48);
    --fc-bubble-footer-out: rgba(255, 255, 255, 0.88);
    --fc-compose-pill-bg: #ffffff;
    --fc-compose-bar-bg: rgba(197, 210, 229, 0.92);
    --fc-send-glyph-from: #0d9488;
    --fc-send-glyph-to: #2563eb;
}

body {
    background: var(--fc-bg) !important;
    color: var(--fc-text);
}

body .app-container {
    background: var(--fc-bg) !important;
    min-height: 100vh;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
}

/* Одна колонка 800px: шапка и main совпадают по ширине с вкладками */
body .app-container > .fc-main-header,
body .app-container > .main-column {
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.main-column {
    background: transparent !important;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.fc-main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 auto;
    width: 100%;
    padding: 1rem 0 0.75rem;
}

.fc-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.fc-logo-bubbles {
    display: inline-flex;
    align-items: flex-end;
    gap: -4px;
}

.fc-logo-bubbles span {
    display: block;
    width: 22px;
    height: 22px;
    border-radius: 50% 50% 50% 4px;
    background: var(--fc-logo-c);
    transform: rotate(-6deg);
}

.fc-logo-bubbles span:last-child {
    width: 16px;
    height: 16px;
    margin-left: -8px;
    margin-bottom: 2px;
    background: var(--fc-logo-f);
    border: 2px solid var(--fc-logo-c);
    transform: rotate(8deg);
}

.fc-brand-title {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--fc-text);
}

.fc-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fc-avatar-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--fc-border);
    overflow: hidden;
    padding: 0;
    background: var(--fc-surface-2);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fc-avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fc-icon-btn-plain {
    background: transparent;
    border: none;
    color: var(--fc-text);
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.85;
    padding: 6px;
    border-radius: 8px;
}

.fc-icon-btn-plain:hover {
    opacity: 1;
    background: rgba(51, 144, 236, 0.12);
}

.fc-icon-btn-plain--svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.fc-icon-btn-plain--svg .fc-logout-svg {
    width: 22px;
    height: 22px;
    display: block;
    pointer-events: none;
}

.app-container .tabs {
    border-bottom-color: var(--fc-border) !important;
}

.app-container .tab {
    color: var(--fc-muted) !important;
}

.app-container .tab.active {
    color: var(--fc-text) !important;
}

.app-container .tab.active::after {
    background: var(--fc-accent) !important;
}

/* Контент вкладок и выпадающие результаты поиска: иначе в тёмной теме
 наследуется светлый --fc-text от body на почти белом фоне из style.css — текст не виден. */
.app-container .tab-content,
body .app-container #tabContent.tab-content {
    background: var(--fc-surface) !important;
    color: var(--fc-text);
    min-height: min(520px, calc(100dvh - 220px));
    box-sizing: border-box;
    width: 100%;
}

.app-container .create-chat-container,
.app-container .search-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Список чатов как в макете: без «острова» внутри вкладки, строки без legacy-карточек .chat-item */
.app-container .tab-content .fc-chat-list {
    background: transparent;
    border: none;
    border-radius: 0;
}

.app-container .fc-chat-row.chat-item {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 12px 14px !important;
    transform: none !important;
}

.app-container .fc-chat-row.chat-item:hover {
    background: rgba(51, 144, 236, 0.12) !important;
    border-color: transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

.app-container .search-results {
    background: var(--fc-surface-2) !important;
    border: 1px solid var(--fc-border) !important;
    color: var(--fc-text) !important;
}

.app-container .search-results-list {
    color: var(--fc-text);
}

.app-container .search-result-item {
    border-bottom-color: var(--fc-border) !important;
    color: var(--fc-text);
}

.app-container .search-result-item:hover {
    background: var(--fc-surface-2) !important;
}

.app-container .search-result-item .user-name,
.app-container .search-result-item .chat-name {
    color: var(--fc-text);
}

.app-container .search-result-item .chat-meta {
    color: var(--fc-muted);
}

.app-container .empty-state {
    color: var(--fc-muted);
}

.fc-chat-list {
    background: var(--fc-surface);
    border-radius: var(--fc-radius);
    border: 1px solid var(--fc-border);
    overflow: hidden;
}

.fc-chat-row {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--fc-border);
    cursor: pointer;
}

.fc-chat-row:last-child {
    border-bottom: none;
}

.fc-chat-row--active {
    background: rgba(51, 144, 236, 0.12);
}

.fc-chat-row-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--fc-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    overflow: hidden;
    flex-shrink: 0;
}

.fc-chat-row-avatar .fc-chat-row-av-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.fc-group-av-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--fc-surface-2);
    color: var(--fc-muted);
    border-radius: 50%;
    flex-shrink: 0;
    box-sizing: border-box;
    border: 1px solid var(--fc-border);
}

.fc-group-av-ph-svg {
    width: 55%;
    height: 55%;
    display: block;
}

.fc-group-av-placeholder--row {
    width: 100%;
    height: 100%;
}

.fc-group-av-placeholder--header {
    width: 40px;
    height: 40px;
}

.fc-group-av-placeholder--sheet {
    width: 100%;
    height: 100%;
}

.fc-group-av-placeholder--editor {
    width: 88px;
    height: 88px;
}

.fc-group-av-placeholder--preview {
    width: 72px;
    height: 72px;
}

.fc-chat-header-av-btn {
    flex-shrink: 0;
    position: relative;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    color: var(--fc-text);
    /* Один слот: не inline-flex — иначе img + плейсхолдер + буква выстраиваются в ряд, если [hidden] перебит display из темы */
    display: inline-block;
    vertical-align: middle;
}

.fc-chat-header-av-btn:focus-visible {
    outline: 2px solid var(--fc-accent);
    outline-offset: 2px;
}

.fc-chat-header-av-btn > .fc-chat-header-av-img,
.fc-chat-header-av-btn > .fc-group-av-placeholder--header,
.fc-chat-header-av-btn > .fc-chat-header-av-letter {
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 40px;
    box-sizing: border-box;
}

/* [hidden] перебивается правилами .fc-group-av-placeholder / .fc-chat-header-av-img (display:flex|block) — как у .fc-media-sheet-row[hidden] */
.fc-chat-header-av-btn > .fc-chat-header-av-img[hidden],
.fc-chat-header-av-btn > .fc-group-av-placeholder[hidden],
.fc-chat-header-av-btn > .fc-chat-header-av-letter[hidden] {
    display: none !important;
}

.fc-chat-header-av-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 1px solid var(--fc-border);
}

.fc-chat-header-av-letter {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--fc-border);
    background: var(--fc-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    color: var(--fc-text);
}

/* Профиль из шапки чата + лайтбокс: внутри .chat-container — не шире/выше колонки чата */
body.page-chat .fc-chat-profile-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    background: var(--fc-bg);
    color: var(--fc-text);
    max-width: 100%;
    max-height: 100%;
    padding-top: max(0px, env(safe-area-inset-top, 0px));
    padding-bottom: max(0px, env(safe-area-inset-bottom, 0px));
    padding-left: max(0px, env(safe-area-inset-left, 0px));
    padding-right: max(0px, env(safe-area-inset-right, 0px));
    box-sizing: border-box;
    overflow: hidden;
}

body.page-chat .fc-chat-profile-overlay[hidden] {
    display: none !important;
}

body.page-chat .fc-chat-profile-shell {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

body.page-chat .fc-chat-profile-topbar {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 8px 10px 4px;
}

body.page-chat .fc-chat-profile-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--fc-accent);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

body.page-chat .fc-chat-profile-close:hover {
    background: var(--fc-surface-2);
}

body.page-chat .fc-chat-profile-close-svg {
    width: 26px;
    height: 22px;
}

body.page-chat .fc-chat-profile-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 max(12px, env(safe-area-inset-right)) 20px max(12px, env(safe-area-inset-left));
    box-sizing: border-box;
}

body.page-chat .fc-chat-profile-hero--sheet {
    border-bottom: none;
    margin-bottom: 8px;
}

body.page-chat .fc-chat-profile-avatar-tap {
    cursor: pointer;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    width: 96px;
    height: 96px;
    display: block;
    position: relative;
}

body.page-chat .fc-chat-profile-avatar-tap:focus-visible {
    outline: 2px solid var(--fc-accent);
    outline-offset: 3px;
}

body.page-chat .fc-chat-profile-avatar-img {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

body.page-chat .fc-chat-profile-avatar-tap .fc-group-av-placeholder--sheet {
    position: absolute;
    inset: 0;
}

body.page-chat .fc-chat-profile-avatar-tap .fc-profile-avatar-ph {
    font-size: 2.5rem;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.page-chat .fc-chat-profile-avatar-letter {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 600;
    background: var(--fc-surface-2);
}

/* [hidden] перебивается display:flex|block у детей — иначе плейсхолдер остаётся поверх фото после лайтбокса */
body.page-chat .fc-chat-profile-avatar-tap > .fc-chat-profile-avatar-img[hidden],
body.page-chat .fc-chat-profile-avatar-tap > .fc-profile-avatar-ph[hidden],
body.page-chat .fc-chat-profile-avatar-tap > .fc-group-av-placeholder[hidden],
body.page-chat .fc-chat-profile-avatar-tap > .fc-chat-profile-avatar-letter[hidden] {
    display: none !important;
}

body.page-chat .fc-chat-group-profile-members {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--fc-border);
}

body.page-chat .fc-chat-group-profile-members-title {
    margin: 0 0 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--fc-muted);
    text-align: center;
}

body.page-chat .fc-chat-group-profile-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 420px;
    margin: 0 auto;
}

body.page-chat .fc-chat-group-profile-part {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--fc-surface);
    border: 1px solid var(--fc-border);
}

body.page-chat .fc-chat-group-profile-part-name {
    font-weight: 500;
    color: var(--fc-text);
    min-width: 0;
    word-break: break-word;
}

body.page-chat .fc-chat-group-profile-part .owner-badge {
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--fc-accent) 22%, transparent);
    color: var(--fc-accent);
    font-weight: 600;
}

[data-theme="light"] body.page-chat .fc-chat-group-profile-part .owner-badge {
    background: color-mix(in srgb, var(--fc-accent) 18%, var(--fc-surface));
}

body.page-chat .fc-avatar-lightbox {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    background: #000;
    max-width: 100%;
    max-height: 100%;
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    box-sizing: border-box;
}

body.page-chat .fc-avatar-lightbox[hidden] {
    display: none !important;
}

body.page-chat .fc-avatar-lightbox-close {
    position: absolute;
    top: max(8px, env(safe-area-inset-top));
    left: max(8px, env(safe-area-inset-left));
    right: auto;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

body.page-chat .fc-avatar-lightbox-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 16px 24px;
    box-sizing: border-box;
}

body.page-chat .fc-avatar-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0;
}

body.page-chat .fc-avatar-lightbox-letter {
    font-size: min(22vw, 120px);
    font-weight: 700;
    color: #fff;
    text-align: center;
    user-select: none;
}

.fc-group-create-avatar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.fc-group-create-avatar-preview {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--fc-surface-2);
    border: 1px solid var(--fc-border);
    flex-shrink: 0;
}

.fc-group-create-avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fc-group-avatar-editor-preview {
    width: 120px;
    height: 120px;
    margin: 0 auto 14px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--fc-surface-2);
    border: 1px solid var(--fc-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fc-group-avatar-editor-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fc-group-edit-modal .fc-group-edit-hint {
    margin: 0 0 12px;
    font-size: 0.9rem;
    color: var(--fc-muted);
    line-height: 1.4;
}

.fc-group-edit-modal .fc-group-edit-pick {
    width: 100%;
    margin-bottom: 16px;
}

.fc-modal-dual-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

.fc-modal-dual-actions .btn-secondary,
.fc-modal-dual-actions .btn-primary {
    flex: 1 1 auto;
    min-width: 6rem;
}

.fc-preview-group-av-wrap {
    text-align: center;
    margin-bottom: 12px;
}

.fc-preview-group-av-img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--fc-border);
    vertical-align: middle;
}

.fc-chat-row-main .name {
    font-weight: 600;
    color: var(--fc-text);
}

.fc-chat-row-main .preview {
    font-size: 0.85rem;
    color: var(--fc-muted);
    margin-top: 2px;
}

.fc-chat-row-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    text-align: right;
    font-size: 0.8rem;
    color: var(--fc-muted);
    min-width: 3rem;
}

.fc-chat-row-meta-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.fc-chat-row-time {
    font-size: 0.8rem;
    color: var(--fc-muted);
    line-height: 1.2;
    white-space: nowrap;
}

/* Счётчик непрочитанных: круг, акцентный фон, цифра по центру (макеты светлой/тёмной темы) */
.fc-unread {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    min-width: 22px;
    padding: 0;
    border-radius: 50%;
    background: var(--fc-accent);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    box-sizing: border-box;
}

.fc-unread.fc-unread--wide {
    width: auto;
    min-width: 24px;
    padding: 0 7px;
    border-radius: 999px;
}

.fc-secondary-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: nowrap;
    min-width: 0;
}

.fc-pill-tab {
    border: 1px solid var(--fc-border);
    background: var(--fc-surface);
    color: var(--fc-muted);
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.9rem;
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    line-height: 1.25;
}

@media (max-width: 420px) {
    .fc-pill-tab {
        padding: 7px 8px;
        font-size: 0.82rem;
    }
}

.fc-pill-tab.active {
    background: var(--fc-accent);
    color: #fff;
    border-color: var(--fc-accent);
}

.fc-field-label {
    font-size: 0.8rem;
    color: var(--fc-muted);
    margin-bottom: 6px;
}

.fc-input {
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    border-radius: var(--fc-radius);
    border: 1px solid var(--fc-border);
    background: var(--fc-input-bg);
    color: var(--fc-text);
    font-size: 0.95rem;
    box-sizing: border-box;
}

.fc-input::placeholder {
    text-overflow: ellipsis;
}

input.fc-input {
    font-size: max(16px, 0.95rem);
}

.fc-btn-primary {
    background: var(--fc-accent);
    color: #fff;
    border: none;
    border-radius: var(--fc-radius);
    padding: 12px 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

.fc-chat-preview-modal .fc-preview-sheet {
    max-width: 420px;
    width: 92vw;
    max-height: 88vh;
    overflow: auto;
    background: var(--fc-surface);
    color: var(--fc-text);
    border-radius: 16px;
    border: 1px solid var(--fc-border);
    padding: 16px;
}

.fc-preview-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0;
}

.fc-preview-tab {
    font-size: 0.78rem;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--fc-border);
    background: var(--fc-surface-2);
    color: var(--fc-muted);
    cursor: pointer;
}

.fc-preview-tab.active {
    background: var(--fc-accent);
    color: #fff;
    border-color: var(--fc-accent);
}

.fc-participant-row {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--fc-border);
}

.fc-participant-row:last-child {
    border-bottom: none;
}

.fc-participant-name {
    font-weight: 600;
}

.fc-participant-status {
    font-size: 0.8rem;
    color: var(--fc-muted);
}

/* Профиль: прокрутка внутри колонки, а не «рост» всей страницы */
body.page-profile {
    margin: 0;
    min-height: 100dvh;
    overflow: hidden;
}

body.page-profile .profile-container {
    background: var(--fc-bg) !important;
    color: var(--fc-text);
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    max-height: 100dvh;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
}

/* Компактнее блоки по умолчанию — меньше прокрутки на типичном ноутбуке */
body.page-profile .fc-profile-hero {
    padding-bottom: 14px;
    margin-bottom: 14px;
}

body.page-profile .fc-theme-block {
    padding: 12px 0 14px;
    margin-bottom: 2px;
}

body.page-profile .fc-profile-edit {
    margin: 14px 0;
    padding-top: 6px;
}

body.page-profile .profile-settings h3,
body.page-profile .profile-settings .setting-item {
    margin-top: 0.5rem;
}

.profile-container {
    background: var(--fc-bg) !important;
    color: var(--fc-text);
    max-width: 800px;
}

@media (max-height: 780px) {
    body.page-profile .profile-container {
        margin: 0 auto;
        padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
        padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
        padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    }

    .profile-header {
        margin-bottom: 1rem;
        gap: 1rem;
    }

    .fc-profile-hero {
        padding-bottom: 12px;
        margin-bottom: 12px;
    }

    .fc-profile-avatar-wrap {
        width: 80px;
        height: 80px;
    }

    .fc-profile-name {
        font-size: 1.15rem;
        margin: 6px 0 4px;
    }

    .fc-profile-meta {
        font-size: 0.88rem;
        margin: 3px 0;
    }

    .fc-theme-block {
        padding: 10px 0 12px;
        margin-bottom: 2px;
    }

    .fc-profile-edit {
        margin: 12px 0;
        padding-top: 6px;
    }

    .fc-profile-edit h3 {
        margin-bottom: 8px;
    }

    .profile-card .form-group {
        margin-bottom: 0.65rem;
    }
}

.profile-card {
    background: var(--fc-surface) !important;
    border: 1px solid var(--fc-border) !important;
    color: var(--fc-text);
}

.fc-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--fc-border);
}

.fc-switch {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: var(--fc-border);
    border: none;
    cursor: pointer;
}

.fc-switch.on {
    background: var(--fc-accent);
}

.fc-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}

.fc-switch.on::after {
    transform: translateX(20px);
}

.fc-switch.fc-switch--theme {
    width: 52px;
    height: 26px;
    flex-shrink: 0;
}

.fc-switch.fc-switch--theme::after {
    width: 22px;
    height: 22px;
    top: 2px;
    left: 2px;
}

.fc-switch.fc-switch--theme.on::after {
    transform: translateX(26px);
}

.fc-theme-block {
    text-align: center;
    padding: 16px 0 20px;
    border-bottom: 1px solid var(--fc-border);
    margin-bottom: 4px;
}

.fc-theme-block-title {
    font-weight: 600;
    color: var(--fc-text);
    margin: 0 auto 14px;
    font-size: 1rem;
}

.fc-theme-segmented {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.fc-theme-side-label {
    font-size: 0.9rem;
    color: var(--fc-muted);
    min-width: 4.25rem;
    text-align: center;
    transition: color 0.15s ease, font-weight 0.15s ease;
}

.fc-theme-side-label--active {
    color: var(--fc-text);
    font-weight: 600;
}

.fc-profile-hero {
    text-align: center;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--fc-border);
    margin-bottom: 18px;
}

.fc-profile-avatar-wrap {
    width: 96px;
    height: 96px;
    margin: 0 auto 10px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--fc-surface-2);
    border: 2px solid var(--fc-border);
}

.fc-profile-avatar-ph {
    font-size: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.fc-profile-name {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 10px 0 6px;
    color: var(--fc-text);
}

.fc-profile-meta {
    color: var(--fc-muted);
    margin: 4px 0;
    font-size: 0.95rem;
}

.fc-profile-avatar-btn {
    margin-bottom: 10px;
}

.fc-profile-edit {
    margin: 18px 0;
    padding-top: 8px;
    border-top: 1px solid var(--fc-border);
}

.fc-profile-edit h3 {
    margin-bottom: 12px;
    color: var(--fc-text);
}

.fc-chat-emoji-av,
.fc-chat-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--fc-text);
}

.fc-chat-initial[hidden] {
    display: none !important;
}

.fc-chat-emoji-av {
    font-size: 1.35rem;
}

.fc-chat-row .settings-btn {
    margin-top: 4px;
    padding: 4px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.75;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--fc-muted);
    border-radius: 8px;
    line-height: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.fc-chat-row .settings-btn:hover {
    opacity: 1;
    color: var(--fc-text);
    background: rgba(51, 144, 236, 0.1);
}

.fc-chat-row .settings-btn .fc-settings-gear-svg {
    width: 20px;
    height: 20px;
    display: block;
    pointer-events: none;
}

/* «Создать чат»: блоки выбранных участников не на светло-сером фоне из style.css */
.app-container .selected-user,
.app-container .selected-users {
    background: var(--fc-surface-2) !important;
    color: var(--fc-text);
    border: 1px solid var(--fc-border);
}

.app-container .empty-selection {
    color: var(--fc-muted);
}

.app-container .search-box input {
    border-color: var(--fc-border) !important;
    background: var(--fc-input-bg) !important;
    color: var(--fc-text) !important;
}

.app-container .search-box input:focus {
    border-color: rgba(51, 144, 236, 0.75) !important;
    outline: none;
}

/* Профиль: шапка и подписи формы */
.profile-header h2 {
    color: var(--fc-text);
}

.profile-container .back-link {
    color: var(--fc-accent);
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 10px 8px 4px;
    margin: -8px 0 -8px -4px;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
}

.profile-card label {
    color: var(--fc-muted);
}

.profile-settings h3 {
    color: var(--fc-text);
}

.profile-settings .setting-label {
    color: var(--fc-text);
}

.profile-settings .setting-description {
    color: var(--fc-muted);
    font-size: 0.9rem;
    line-height: 1.45;
    margin-top: 0.35rem;
}

.e2e-status-line {
    color: var(--fc-muted) !important;
}

/* E2E: списки действий (профиль, баннеры, модалки) — переменные темы вместо жёсткого белого */
.e2e-action-sheet {
    background: var(--fc-surface-2);
    border: 1px solid var(--fc-border);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.1);
}

[data-theme="dark"] .e2e-action-sheet {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.e2e-action-sheet--in-banner {
    background: var(--fc-surface-2);
    border-color: var(--fc-border);
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] .e2e-action-sheet--in-banner {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.e2e-action-divider {
    background: var(--fc-border);
}

.e2e-action-row {
    color: var(--fc-text);
}

.e2e-action-row:hover {
    background: rgba(51, 144, 236, 0.1);
}

.e2e-action-row:focus-visible {
    outline: 2px solid var(--fc-accent);
    outline-offset: -2px;
    background: rgba(51, 144, 236, 0.12);
}

.e2e-action-row:active {
    background: rgba(51, 144, 236, 0.16);
}

.e2e-action-row__icon {
    color: var(--fc-muted);
}

.e2e-action-row--accent .e2e-action-row__icon {
    color: var(--fc-accent);
}

.e2e-action-row--muted .e2e-action-row__icon,
.e2e-action-row--muted .e2e-action-row__label {
    color: var(--fc-muted);
}

.e2e-action-row__chev {
    color: var(--fc-muted);
}

.e2e-action-row--danger .e2e-action-row__icon,
.e2e-action-row--danger .e2e-action-row__label {
    color: #c62828;
}

.e2e-action-row--danger:hover {
    background: rgba(198, 40, 40, 0.08);
}

.e2e-action-row--danger:focus-visible {
    outline-color: #c62828;
    background: rgba(198, 40, 40, 0.1);
}

[data-theme="dark"] .e2e-action-row--danger .e2e-action-row__icon,
[data-theme="dark"] .e2e-action-row--danger .e2e-action-row__label {
    color: #f87171;
}

[data-theme="dark"] .e2e-action-row--danger:hover {
    background: rgba(248, 113, 113, 0.12);
}

[data-theme="dark"] .e2e-action-row--danger:focus-visible {
    outline-color: #f87171;
    background: rgba(248, 113, 113, 0.14);
}

.e2e-profile-device-hint {
    color: var(--fc-muted);
}

/* Базовые модалки (.modal из style.css): поверхность и поля по теме */
.modal .modal-content {
    background: var(--fc-surface);
    color: var(--fc-text);
    border: 1px solid var(--fc-border);
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
}

[data-theme="dark"] .modal .modal-content {
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .modal:not(.fc-modal-overlay) {
    background: rgba(0, 0, 0, 0.62);
}

.modal .modal-content h3 {
    color: var(--fc-text);
}

.modal .modal-content textarea {
    background: var(--fc-input-bg);
    color: var(--fc-text);
    border-color: var(--fc-border);
}

.modal .modal-content textarea:focus {
    border-color: rgba(51, 144, 236, 0.75);
    outline: none;
}

/* Модалки «Действия с чатом» / подтверждение: единая поверхность темы, без белой «оболочки» */
.modal-content.modal-content--chat-actions {
    background: var(--fc-surface) !important;
    border: 1px solid var(--fc-border);
    color: var(--fc-text);
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
}

[data-theme="dark"] .modal-content.modal-content--chat-actions {
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55);
}

.modal-content.modal-content--chat-actions h3 {
    color: var(--fc-text) !important;
    margin-top: 0;
}

.modal-content.modal-content--chat-actions #deleteChatConfirmText {
    color: var(--fc-muted) !important;
}

.modal-content.modal-content--chat-actions .e2e-action-sheet--modal {
    margin-top: 0.65rem;
    background: var(--fc-surface-2);
    border: 1px solid var(--fc-border);
    box-shadow: none;
}

/* Страница настроек группы */
body.fc-group-settings-page {
    min-height: 100vh;
}

.fc-group-settings-page .settings-container {
    background: var(--fc-surface) !important;
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius);
    box-shadow: 0 10px 36px rgba(15, 23, 42, 0.1);
    color: var(--fc-text);
}

[data-theme="dark"] .fc-group-settings-page .settings-container {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.fc-group-settings-page .settings-header {
    border-bottom-color: var(--fc-border);
}

.fc-group-settings-page .settings-header h2 {
    color: var(--fc-text);
}

.fc-group-settings-page .back-link {
    color: var(--fc-accent);
}

.fc-group-settings-page .info-section,
.fc-group-settings-page .participants-section {
    background: var(--fc-surface-2);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius);
}

.fc-group-settings-page .info-section h3,
.fc-group-settings-page .participants-section h3 {
    color: var(--fc-text);
}

.fc-group-settings-page .fc-group-settings-actions-wrap .fc-group-settings-sheet {
    margin-top: 10px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: none;
}

.fc-group-settings-page .fc-group-settings-actions-wrap .e2e-action-row {
    width: 100%;
    text-align: left;
    font: inherit;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    box-sizing: border-box;
}

.fc-group-settings-page .info-row {
    border-bottom-color: var(--fc-border);
}

.fc-group-settings-page .info-row label {
    color: var(--fc-muted);
}

.fc-group-settings-page .mono {
    color: var(--fc-muted);
}

.fc-group-settings-page .role-badge {
    background: rgba(51, 144, 236, 0.2);
    color: var(--fc-accent);
    border-radius: 6px;
    font-weight: 600;
}

.fc-group-settings-page .add-participant input.fc-input,
.fc-group-settings-page .add-participant .fc-input {
    box-sizing: border-box;
}

.fc-group-settings-page .participant-item {
    border-bottom-color: var(--fc-border);
}

.fc-group-settings-page .participant-name {
    color: var(--fc-text);
}

.fc-group-settings-page .owner-badge {
    background: rgba(52, 211, 153, 0.18);
    color: #34d399;
    border-radius: 6px;
    font-weight: 600;
}

[data-theme="light"] .fc-group-settings-page .owner-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}

.fc-group-settings-page .btn-small.remove-participant {
    background: rgba(51, 144, 236, 0.15);
    color: var(--fc-accent);
    border:1px solid rgba(51, 144, 236, 0.35);
    border-radius: 8px;
}

.fc-group-settings-page .btn-small.remove-participant:hover {
    background: rgba(51, 144, 236, 0.25);
}

.fc-group-settings-page .loading {
    color: var(--fc-muted);
}

.fc-group-settings-page .search-results {
    background: var(--fc-surface);
    border: 1px solid var(--fc-border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
    color: var(--fc-text);
}

[data-theme="light"] .fc-group-settings-page .search-results {
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

/* Результаты поиска участников: не в .app-container, иначе hover из style.css (#f5f5f5) ломает тёмную тему */
.fc-group-settings-page .search-results .search-result-item {
    border-bottom: 1px solid var(--fc-border);
    color: var(--fc-text);
}

.fc-group-settings-page .search-results .search-result-item:last-child {
    border-bottom: none;
}

.fc-group-settings-page .search-results .search-result-item:hover {
    background: rgba(51, 144, 236, 0.14) !important;
    color: var(--fc-text);
}

.fc-group-settings-page .search-results .search-result-item .user-name {
    color: var(--fc-text);
}

.fc-group-settings-page .search-results .btn-small.add-participant {
    background: var(--fc-accent);
    color: #fff;
    flex-shrink: 0;
}

.fc-group-settings-page .search-results .btn-small.add-participant:hover {
    filter: brightness(1.06);
}

.fc-group-settings-page .search-results .search-result-item.fc-search-result-empty {
    cursor: default;
    justify-content: center;
    color: var(--fc-muted);
}

.fc-group-settings-page .search-results .search-result-item.fc-search-result-empty:hover {
    background: transparent !important;
}

/* Модалка удаления группы */
.fc-modal-overlay.modal {
    background: rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .fc-modal-overlay.modal {
    background: rgba(0, 0, 0, 0.65);
}

.fc-modal-panel.modal-content {
    background: var(--fc-surface) !important;
    border: 1px solid var(--fc-border);
    color: var(--fc-text);
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.2);
}

[data-theme="dark"] .fc-modal-panel.modal-content {
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55);
}

.fc-modal-panel.modal-content h3 {
    color: var(--fc-text) !important;
}

.fc-modal-panel.modal-content p {
    color: var(--fc-muted);
}

.fc-modal-panel.modal-content .warning {
    color: #f87171;
}

[data-theme="light"] .fc-modal-panel.modal-content .warning {
    color: #c62828;
}

/* ========== Страница чата (фон-паттерн, пузыри, композ как в макете) ========== */
body.page-chat {
    background: var(--fc-chat-bg) !important;
}

body.page-chat .chat-container {
    background: transparent;
    max-width: 800px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    align-self: stretch;
    position: relative;
    z-index: 0;
}

body.page-chat .chat-header {
    background: var(--fc-chat-header-bg);
    border-bottom: 1px solid var(--fc-border);
    box-shadow: none;
    padding: 0.65rem 0.85rem;
    /* Сетка: назад | зона заголовка | иконки — заголовок позиционируем внутри средней колонки */
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
}

body.page-chat .header-left {
    display: contents;
}

body.page-chat .chat-header .header-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-shrink: 0;
    margin-left: 0;
    gap: 4px;
    grid-column: 3;
}

body.page-chat .fc-chat-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    margin-right: 0;
    border-radius: 50%;
    color: var(--fc-accent);
    text-decoration: none;
    line-height: 0;
    flex-shrink: 0;
    grid-column: 1;
    -webkit-tap-highlight-color: transparent;
    background: var(--fc-surface-2);
    transition: background 0.15s ease, opacity 0.15s ease;
}

body.page-chat .fc-chat-back:hover {
    background: var(--fc-border);
    opacity: 1;
}

body.page-chat .fc-chat-back.fc-chat-back--plain {
    background: transparent;
    border-radius: 10px;
}

body.page-chat .fc-chat-back.fc-chat-back--plain:hover {
    background: var(--fc-surface-2);
    border-radius: 10px;
}

body.page-chat .fc-chat-back-svg {
    width: 22px;
    height: 19px;
    display: block;
}

@media (max-width: 640px) {
    body.page-chat .fc-chat-back {
        width: 52px;
        height: 52px;
        min-width: 52px;
        min-height: 52px;
        margin-right: 4px;
        touch-action: manipulation;
    }

    body.page-chat .fc-chat-back-svg {
        width: 24px;
        height: 21px;
    }
}

body.page-chat .fc-chat-header-title-block {
    grid-column: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding-left: 0.35rem;
    box-sizing: border-box;
}

body.page-chat .chat-header-titles {
    min-width: 0;
    flex: 1;
    padding-left: 0;
    text-align: left;
}

body.page-chat .chat-header-titles h2,
body.page-chat #chatTitle {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--fc-text);
    line-height: 1.2;
}

body.page-chat .chat-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.78rem;
    color: var(--fc-muted);
    line-height: 1.25;
}

body.page-chat .fc-chat-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--fc-text);
    opacity: 0.92;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, opacity 0.15s ease;
}

body.page-chat .fc-chat-header-icon:hover {
    background: var(--fc-surface-2);
    opacity: 1;
}

body.page-chat .fc-chat-header-icon:active {
    opacity: 0.88;
}

body.page-chat .fc-header-svg {
    width: 22px;
    height: 22px;
    display: block;
}

body.page-chat .fc-header-icon-slot {
    display: flex;
    align-items: center;
    justify-content: center;
}

body.page-chat .fc-header-icon-slot--bell-off {
    display: none;
}

body.page-chat .sound-toggle.sound-toggle--muted .fc-header-icon-slot--bell-on {
    display: none;
}

body.page-chat .sound-toggle.sound-toggle--muted .fc-header-icon-slot--bell-off {
    display: flex;
}

body.page-chat .fc-chat-header-overflow-wrap {
    position: relative;
    flex-shrink: 0;
}

body.page-chat .fc-chat-header-overflow-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    display: none;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    background: var(--fc-chat-header-bg);
    border: 1px solid var(--fc-border);
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
    z-index: 120;
    -webkit-tap-highlight-color: transparent;
}

body.page-chat .fc-chat-header-overflow-panel:not([hidden]) {
    display: flex;
}

[data-theme="dark"] body.page-chat .fc-chat-header-overflow-panel {
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}

body.page-chat .chat-type-badge {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--fc-border);
    background: transparent;
    color: var(--fc-muted);
    line-height: 1;
    flex-shrink: 0;
}

body.page-chat .chat-type-badge.private {
    border-color: rgba(72, 187, 120, 0.5);
    color: #2f855a;
}

[data-theme="dark"] body.page-chat .chat-type-badge.private {
    color: #6ee7b7;
    border-color: rgba(110, 231, 183, 0.4);
}

body.page-chat .chat-type-badge.group {
    border-color: rgba(102, 126, 234, 0.55);
    color: #5a67d8;
}

[data-theme="dark"] body.page-chat .chat-type-badge.group {
    color: #a5b4fc;
    border-color: rgba(165, 180, 252, 0.45);
}

/* Палитра реакций (ПКМ / long-press): на body, обе темы */
.context-reaction-menu {
    background: var(--fc-surface);
    border: 1px solid var(--fc-border);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    color: var(--fc-text);
}

[data-theme="dark"] .context-reaction-menu {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.context-reaction-pick {
    background: var(--fc-surface-2);
}

.context-reaction-pick:hover {
    background: var(--fc-border);
}

body.page-chat .messages-container {
    background-color: var(--fc-chat-bg);
    background-image: var(--fc-chat-pattern);
    background-size: 140px 140px;
    padding: 0.75rem 0.85rem 1rem;
    gap: 0.65rem;
}

body.page-chat .loading-messages,
body.page-chat .empty-messages {
    color: var(--fc-muted);
}

body.page-chat .message {
    max-width: min(82%, 420px);
    padding: 0;
    background: transparent !important;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    animation: none;
}

body.page-chat .message.other {
    align-self: flex-start;
}

body.page-chat .message.own {
    align-self: flex-end;
}

body.page-chat .message-author {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--fc-muted);
    padding: 0 0.35rem 0 0.15rem;
}

body.page-chat .message.own .message-author {
    align-self: flex-end;
    text-align: right;
    padding-left: 0.35rem;
    padding-right: 0.15rem;
}

body.page-chat .message-bubble {
    position: relative;
    padding: 0.55rem 0.75rem 0.35rem;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07);
}

body.page-chat .message.other .message-bubble {
    background: var(--fc-bubble-in);
    color: var(--fc-bubble-in-text);
    border-radius: 18px 18px 18px 6px;
}

body.page-chat .message.own .message-bubble {
    background: var(--fc-bubble-out);
    color: var(--fc-bubble-out-text);
    border-radius: 18px 18px 6px 18px;
}

body.page-chat .message-content {
    line-height: 1.45;
    font-size: 0.95rem;
}

body.page-chat .message-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    margin-top: 0.25rem;
}

body.page-chat .message-time {
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
}

body.page-chat .message.other .message-time {
    color: var(--fc-bubble-footer-in);
}

body.page-chat .message.own .message-time,
body.page-chat .message.own .read-status {
    color: var(--fc-bubble-footer-out);
}

body.page-chat .e2e-chat-phrase-notice {
    background: rgba(51, 144, 236, 0.12);
    border: 1px solid rgba(51, 144, 236, 0.35);
    border-radius: 12px;
    color: var(--fc-text);
}

body.page-chat .e2e-chat-phrase-notice-title {
    color: var(--fc-text);
}

body.page-chat .e2e-chat-phrase-notice-text {
    color: var(--fc-muted);
}

body.page-chat .message-input-container {
    background: var(--fc-compose-bar-bg);
    border-top: 1px solid var(--fc-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    gap: 0.45rem;
    padding-top: 0.55rem;
    padding-bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px));
    position: relative;
}

body.page-chat .fc-compose-row {
    flex-wrap: wrap;
    align-items: flex-end;
}

/** Вторая строка: поле + отправка в одну линию (первая строка — блок пересылки, 100% ширины). */
body.page-chat .fc-compose-inline {
    flex: 1 1 100%;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 0.45rem;
}

body.page-chat .fc-attach-sheet {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 12px;
    right: 12px;
    max-width: min(360px, 100%);
    margin: 0 auto;
    background: var(--fc-surface);
    border: 1px solid var(--fc-border);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
    padding: 10px 0 6px;
    z-index: 50;
    overflow: hidden;
}

[data-theme="dark"] body.page-chat .fc-attach-sheet {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

body.page-chat .fc-attach-sheet--open {
    display: block;
}

body.page-chat .fc-attach-sheet__title {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--fc-muted);
    padding: 4px 16px 10px;
    margin: 0;
}

body.page-chat .fc-attach-sheet__actions {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 6px;
}

body.page-chat .fc-attach-tile {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--fc-text);
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 500;
    text-align: left;
    font-family: inherit;
    line-height: 1.25;
    -webkit-tap-highlight-color: transparent;
}

body.page-chat .fc-attach-tile:hover {
    background: var(--fc-surface-2);
}

body.page-chat .fc-attach-tile:focus-visible {
    outline: 2px solid rgba(51, 144, 236, 0.55);
    outline-offset: -2px;
}

body.page-chat .fc-attach-tile:active {
    background: var(--fc-surface-2);
    opacity: 0.92;
}

body.page-chat .fc-attach-tile__ic {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fc-text);
    opacity: 0.95;
}

body.page-chat .fc-attach-svg {
    width: 24px;
    height: 24px;
    display: block;
}

body.page-chat .fc-attach-tile__tx {
    flex: 1;
    min-width: 0;
}

/* Модальное окно: превью вложения и подпись перед отправкой */
body.page-chat .fc-send-media-modal {
    position: fixed;
    inset: 0;
    z-index: 240;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
}

body.page-chat .fc-send-media-modal[hidden] {
    display: none !important;
}

body.page-chat .fc-send-media-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

body.page-chat .fc-send-media-modal__panel {
    position: relative;
    width: min(400px, 100%);
    max-height: min(88vh, 560px);
    display: flex;
    flex-direction: column;
    background: var(--fc-surface);
    border: 1px solid var(--fc-border);
    border-radius: 18px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

body.page-chat .fc-send-media-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--fc-border);
}

body.page-chat .fc-send-media-close {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: var(--fc-surface-2);
    color: var(--fc-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

body.page-chat .fc-send-media-close svg {
    width: 22px;
    height: 22px;
}

body.page-chat .fc-send-media-close:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

body.page-chat .fc-send-media-title {
    flex: 1;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--fc-text);
}

body.page-chat .fc-send-media-head-spacer {
    width: 40px;
    flex-shrink: 0;
}

body.page-chat .fc-send-media-body {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 16px 14px 14px;
    flex: 1;
    min-height: 0;
}

body.page-chat .fc-send-media-thumb-wrap {
    position: relative;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--fc-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* absolute + cover: иначе во flex-контейнере intrinsic-ширина img даёт «половину» кадра */
body.page-chat .fc-send-media-thumb-img,
body.page-chat .fc-send-media-thumb-video {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

body.page-chat .fc-send-media-thumb-icon {
    font-size: 2rem;
    line-height: 1;
}

body.page-chat .fc-send-media-meta {
    flex: 1;
    min-width: 0;
}

body.page-chat .fc-send-media-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--fc-text);
    word-break: break-word;
}

body.page-chat .fc-send-media-size-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0;
    margin-top: 4px;
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--fc-muted);
}

body.page-chat .fc-send-media-size {
    color: inherit;
}

body.page-chat .fc-send-media-dash {
    color: inherit;
    opacity: 0.85;
}

body.page-chat .fc-send-media-show {
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-weight: 600;
    color: var(--fc-accent);
    cursor: pointer;
    text-decoration: none;
}

body.page-chat .fc-send-media-show:hover {
    text-decoration: underline;
}

body.page-chat .fc-send-media-show:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    text-decoration: none;
}

body.page-chat .fc-send-media-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px 14px;
    border-top: 1px solid var(--fc-border);
    position: relative;
}

body.page-chat .fc-send-media-caption {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--fc-border);
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 0.95rem;
    background: var(--fc-compose-pill-bg);
    color: var(--fc-text);
}

body.page-chat .fc-send-media-caption:focus {
    outline: none;
    border-color: var(--fc-accent);
}

body.page-chat .fc-send-media-caption::placeholder {
    color: var(--fc-muted);
}

body.page-chat .fc-send-media-emoji-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(51, 144, 236, 0.16);
    color: var(--fc-accent);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

body.page-chat .fc-send-media-submit {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: var(--fc-bubble-out);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 8px rgba(51, 144, 236, 0.35);
}

body.page-chat .fc-send-media-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

body.page-chat .fc-send-media-glyph {
    width: 22px;
    height: 22px;
    margin-left: 1px;
    display: block;
}

body.page-chat .fc-send-media-emoji-pop {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 52px;
    left: auto;
    z-index: 10;
}

body.page-chat .fc-send-media-emoji-pop .fc-send-media-insert-btn {
    border: none;
    background: var(--fc-surface-2);
    border-radius: 8px;
    font-size: 1.35rem;
    line-height: 1;
    padding: 6px 8px;
    cursor: pointer;
}

body.page-chat .fc-send-media-emoji-pop .fc-send-media-insert-btn:active {
    transform: scale(0.95);
}

body.page-chat .fc-msg-attachment {
    max-width: min(300px, 88vw);
}

body.page-chat .fc-att-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

body.page-chat .fc-att-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.65rem;
}

body.page-chat .fc-att-row--audio {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

body.page-chat .fc-att-row--doc,
body.page-chat .fc-att-row--thumb {
    align-items: center;
}

body.page-chat .fc-att-lead {
    flex-shrink: 0;
}

body.page-chat .fc-att-icon-ball {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
}

body.page-chat .fc-att-icon-ball--pending {
    background: rgba(255, 255, 255, 0.14);
    color: var(--fc-bubble-in-text, #fff);
    font-size: 1.15rem;
    line-height: 1;
    font-weight: 700;
}

body.page-chat .message.own .fc-att-icon-ball--pending {
    background: rgba(0, 0, 0, 0.18);
    color: var(--fc-bubble-out-text, #fff);
}

body.page-chat .fc-att-icon-ball--doc {
    background: rgba(255, 255, 255, 0.14);
    color: var(--fc-bubble-in-text, #fff);
}

body.page-chat .message.own .fc-att-icon-ball--doc {
    background: rgba(0, 0, 0, 0.18);
    color: var(--fc-bubble-out-text, #fff);
}

/* Аудио: контрастный круг (как в Telegram) + скрипичный ключ */
body.page-chat .fc-att-icon-ball--clef {
    background: #2babee;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

body.page-chat .message.own .fc-att-icon-ball--clef {
    background: #2babee;
    color: #fff;
}

body.page-chat .fc-att-clef-char {
    font-family: 'Segoe UI Symbol', 'Apple Symbols', 'Noto Music', 'DejaVu Sans', 'Liberation Serif', serif;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin-top: 2px;
}

body.page-chat .fc-att-audio-clef {
    flex-shrink: 0;
}

body.page-chat .fc-att-col--grow {
    flex: 1;
    min-width: 0;
}

body.page-chat .fc-att-fn {
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.25;
    word-break: break-word;
    color: inherit;
}

body.page-chat .fc-att-meta {
    margin-top: 0.2rem;
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--fc-bubble-footer-in, var(--fc-muted));
}

body.page-chat .message.own .fc-att-meta {
    color: var(--fc-bubble-footer-out, var(--fc-muted));
}

body.page-chat .fc-att-meta .fc-att-size,
body.page-chat .fc-att-meta .fc-att-duration {
    opacity: 0.92;
}

body.page-chat .fc-att-action {
    display: inline;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-weight: 600;
    color: var(--fc-accent);
    cursor: pointer;
    text-decoration: none;
}

body.page-chat .fc-att-action:hover {
    text-decoration: underline;
}

body.page-chat .message.own .fc-att-action {
    color: #fff;
}

body.page-chat .message.own .fc-att-action:hover {
    color: #fff;
    opacity: 0.92;
    text-decoration: underline;
}

body.page-chat .fc-att-thumb-wrap {
    position: relative;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

body.page-chat .fc-att-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    vertical-align: middle;
}

body.page-chat .fc-att-thumb--video {
    background: #000;
}

body.page-chat .fc-att-thumb-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.38);
    pointer-events: none;
}

body.page-chat .fc-att-circle-dl {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
}

body.page-chat .fc-msg-caption {
    font-size: 0.9rem;
    margin-top: 0.15rem;
    word-break: break-word;
    color: inherit;
}

body.page-chat .fc-msg-attachment-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--fc-text);
    margin-bottom: 6px;
    word-break: break-word;
}

body.page-chat .fc-msg-attachment-dl {
    margin-top: 6px;
    font-size: 0.82rem;
}

body.page-chat .fc-msg-media-img {
    display: block;
    max-width: 100%;
    border-radius: 12px;
    vertical-align: middle;
}

body.page-chat .fc-msg-media-video-frame {
    position: relative;
    display: inline-block;
    max-width: 100%;
    vertical-align: top;
    line-height: 0;
}

body.page-chat .fc-msg-media-video-meta-badge {
    position: absolute;
    left: 8px;
    top: 8px;
    z-index: 2;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.52);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    pointer-events: none;
    max-width: calc(100% - 16px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

body.page-chat .fc-msg-media-video {
    display: block;
    max-width: 100%;
    border-radius: 12px;
    vertical-align: top;
}

body.page-chat .fc-msg-media-audio {
    width: 100%;
    min-width: 220px;
}

body.page-chat .fc-msg-file-link {
    color: var(--fc-accent);
    font-weight: 600;
    word-break: break-all;
}

/* Исходящий пузырь: как у .fc-msg-link — иначе accent ≈ фон, ссылка нечитаема */
body.page-chat .message.own .message-bubble .fc-msg-file-link,
body.page-chat .message.own .message-bubble .fc-msg-attachment-dl .fc-msg-file-link {
    color: #e3f2fd;
    text-decoration: underline;
    text-underline-offset: 2px;
}

body.page-chat .message.own .message-bubble .fc-msg-file-link:visited {
    color: #e1f5fe;
}

body.page-chat .fc-send-icon-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

body.page-chat .fc-chat-send-glyph {
    width: 22px;
    height: 22px;
    display: block;
    pointer-events: none;
}

body.page-chat .fc-chat-send-glyph .fc-send-glyph-stop-1 {
    stop-color: var(--fc-send-glyph-from);
}

body.page-chat .fc-chat-send-glyph .fc-send-glyph-stop-2 {
    stop-color: var(--fc-send-glyph-to);
}

body.page-chat .compose-field-wrap {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: flex-end;
    background: var(--fc-compose-pill-bg);
    border: 1px solid var(--fc-border);
    border-radius: 999px;
    padding: 0.12rem 0.2rem 0.12rem 0.65rem;
    min-height: 44px;
    gap: 0.2rem;
}

body.page-chat .fc-mention-picker {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 6px);
    z-index: 10040;
    max-height: 220px;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid var(--fc-border);
    background: var(--fc-surface);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    padding: 4px;
    box-sizing: border-box;
}

body.page-chat .fc-mention-picker[hidden] {
    display: none !important;
}

body.page-chat .fc-mention-picker-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    margin: 0;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--fc-text);
    cursor: pointer;
    text-align: left;
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}

body.page-chat .fc-mention-picker-item:hover,
body.page-chat .fc-mention-picker-item--active {
    background: var(--fc-surface-2);
}

body.page-chat .fc-mention-picker-un {
    font-weight: 600;
    color: var(--fc-accent);
}

body.page-chat .fc-mention-picker-label {
    font-size: 0.88rem;
    color: var(--fc-muted);
}

body.page-chat .message-content .fc-mention,
body.page-chat .fc-fwd-text-body .fc-mention {
    color: var(--fc-accent);
    font-weight: 600;
}

/* Исходящий пузырь = тот же #3390ec, что и --fc-accent — упоминания исчезали. Отдельный акцент. */
body.page-chat .message.own .message-bubble .message-content .fc-mention,
body.page-chat .message.own .message-bubble .fc-fwd-text-body .fc-mention {
    color: #ffe082;
    font-weight: 700;
    text-decoration: none;
}

body.page-chat .message-content a.fc-msg-link,
body.page-chat .fc-fwd-text-body a.fc-msg-link {
    color: var(--fc-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
}

body.page-chat .message.own .message-bubble .message-content a.fc-msg-link,
body.page-chat .message.own .message-bubble .fc-fwd-text-body a.fc-msg-link {
    color: #e3f2fd;
}

body.page-chat .fc-edit-message-field-wrap {
    position: relative;
}

body.page-chat .compose-field-wrap textarea {
    flex: 1;
    border: none !important;
    background: transparent !important;
    border-radius: 0;
    padding: 0.5rem 0.35rem;
    color: var(--fc-text);
    max-height: 120px;
    box-shadow: none !important;
}

body.page-chat .compose-field-wrap textarea:focus {
    outline: none;
    border: none !important;
}

body.page-chat .compose-field-wrap textarea::placeholder {
    color: var(--fc-muted);
}

body.page-chat .compose-attach-btn {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--fc-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.95;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

body.page-chat .compose-emoji-btn {
    background: rgba(51, 144, 236, 0.16);
    color: var(--fc-accent);
}

body.page-chat .fc-chat-send-btn {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    box-sizing: border-box;
    border: 2px solid var(--fc-accent);
    border-radius: 50%;
    background: #ffffff;
    color: var(--fc-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
    -webkit-tap-highlight-color: transparent;
}

[data-theme="dark"] body.page-chat .fc-chat-send-btn {
    background: var(--fc-surface);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}

body.page-chat .fc-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

body.page-chat .fc-chat-send-btn:active:not(:disabled) {
    transform: scale(0.96);
}

body.page-chat .compose-emoji-popover {
    background: var(--fc-surface);
    border-color: var(--fc-border);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

body.page-chat .compose-insert-btn {
    background: var(--fc-surface-2);
}

@media (max-width: 600px) {
    body.page-chat .messages-container {
        padding-bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
    }
}

/* ========== Страницы входа и регистрации (макет Family Chat) ========== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.fc-auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 1.35rem 1rem calc(1.35rem + env(safe-area-inset-bottom, 0px));
    background: var(--fc-bg) !important;
    color: var(--fc-text);
}

.fc-auth-shell {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.fc-auth-brand {
    margin-bottom: 1.75rem;
}

.fc-auth-logo {
    margin: 0 auto 1rem;
    transform: scale(1.15);
}

.fc-auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--fc-text);
    margin: 0;
}

.fc-auth-subtitle {
    margin: 0.5rem 0 0;
    font-size: 0.95rem;
    color: var(--fc-muted);
    font-weight: 500;
}

.fc-auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    text-align: left;
}

.fc-auth-input {
    width: 100%;
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--fc-border);
    border-radius: 999px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--fc-surface-2);
    color: var(--fc-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fc-auth-input::placeholder {
    color: var(--fc-muted);
}

.fc-auth-input:focus {
    outline: none;
    border-color: var(--fc-accent);
    box-shadow: 0 0 0 3px rgba(51, 144, 236, 0.2);
}

.fc-auth-password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.fc-auth-input--with-toggle {
    padding-right: 3rem;
}

.fc-auth-toggle-pw {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.25rem;
    opacity: 0.65;
    color: var(--fc-muted);
}

.fc-auth-toggle-pw:hover {
    opacity: 1;
}

.fc-auth-error {
    font-size: 0.9rem;
    color: #c62828;
    text-align: center;
    padding: 0.25rem 0;
}

[data-theme="dark"] .fc-auth-error {
    color: #f87171;
}

.fc-auth-submit {
    margin-top: 0.35rem;
    width: 100%;
    padding: 0.95rem 1.25rem;
    border: none;
    border-radius: 999px;
    font-size: 1.05rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    background: var(--fc-accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(51, 144, 236, 0.35);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.fc-auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(51, 144, 236, 0.4);
}

.fc-auth-submit:active {
    transform: translateY(0);
}

.fc-auth-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.fc-auth-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 0.25rem;
    font-size: 0.9rem;
}

.fc-auth-footer--single {
    justify-content: center;
    flex-wrap: wrap;
}

.fc-auth-footer-hint {
    color: var(--fc-muted);
}

.fc-auth-footer-link {
    color: var(--fc-accent);
    text-decoration: none;
    font-weight: 500;
}

.fc-auth-footer-link:hover {
    text-decoration: underline;
}

/* ========== Лендинг / (тема по prefers-color-scheme) ========== */
.fc-landing-page {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.fc-landing-shell {
    max-width: 420px;
}

.fc-landing-illustration {
    margin: 0 auto 1.25rem;
    border-radius: var(--fc-radius);
    border: 1px solid var(--fc-border);
    background: var(--fc-surface-2);
    overflow: hidden;
    line-height: 0;
}

.fc-landing-illustration img {
    width: 100%;
    height: auto;
    display: block;
}

.fc-landing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    width: 100%;
    margin-top: 0.25rem;
}

.fc-landing-btn {
    flex: 1 1 calc(50% - 0.375rem);
    min-width: 8.5rem;
    padding: 0.95rem 1rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.fc-landing-btn:active {
    transform: scale(0.98);
}

.fc-landing-btn--primary {
    background: var(--fc-accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(51, 144, 236, 0.35);
}

.fc-landing-btn--primary:hover {
    box-shadow: 0 6px 18px rgba(51, 144, 236, 0.4);
}

.fc-landing-btn--secondary {
    background: var(--fc-surface-2);
    color: var(--fc-text);
    border: 1px solid var(--fc-border);
    box-shadow: none;
}

.fc-landing-btn--secondary:hover {
    background: var(--fc-surface);
    border-color: var(--fc-accent);
}

@media (max-width: 360px) {
    .fc-landing-actions {
        flex-direction: column;
    }

    .fc-landing-btn {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* ========== E2E: баннер и модалка фразы на главной (без «светлого острова») ========== */
.app-container .e2e-recovery-banner,
.app-container .e2e-qr-pair-banner {
    background: var(--fc-surface-2) !important;
    border: 1px solid var(--fc-border) !important;
    color: var(--fc-text) !important;
    border-radius: var(--fc-radius);
    box-shadow: none;
}

.app-container .e2e-recovery-banner-text {
    color: var(--fc-text);
}

/* Модалка recovery phrase: единая поверхность темы */
.fc-e2e-phrase-modal.e2e-phrase-modal-content,
.modal-content.fc-e2e-phrase-modal {
    background: var(--fc-surface) !important;
    border: 1px solid var(--fc-border);
    color: var(--fc-text);
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.2);
}

[data-theme="dark"] .fc-e2e-phrase-modal.e2e-phrase-modal-content,
[data-theme="dark"] .modal-content.fc-e2e-phrase-modal {
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55);
}

.fc-e2e-phrase-modal .e2e-phrase-intro {
    color: var(--fc-text) !important;
}

.fc-e2e-phrase-modal .e2e-recovery-phrase {
    background: var(--fc-surface-2) !important;
    color: var(--fc-text) !important;
    border: 2px dashed rgba(51, 144, 236, 0.55) !important;
}

.fc-e2e-phrase-modal .e2e-phrase-warning {
    color: #b45309;
}

[data-theme="dark"] .fc-e2e-phrase-modal .e2e-phrase-warning {
    color: #fbbf24;
}

.fc-e2e-phrase-modal .e2e-action-sheet--modal {
    margin-top: 0.75rem;
    background: var(--fc-surface-2);
    border: 1px solid var(--fc-border);
    box-shadow: none;
}

/* Редактирование текста сообщения (чат) */
.modal-content.fc-edit-message-modal {
    background: var(--fc-surface) !important;
    border: 1px solid var(--fc-border);
    color: var(--fc-text);
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.2);
}

[data-theme="dark"] .modal-content.fc-edit-message-modal {
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55);
}

.modal-content.fc-edit-message-modal h3 {
    color: var(--fc-text) !important;
    margin-top: 0;
}

.modal-content.fc-edit-message-modal textarea {
    background: var(--fc-surface-2) !important;
    color: var(--fc-text) !important;
    border: 1px solid var(--fc-border) !important;
    border-radius: var(--fc-radius, 10px);
}

.modal-content.fc-edit-message-modal textarea:focus {
    border-color: rgba(51, 144, 236, 0.75) !important;
    outline: none;
}

.modal-content.fc-edit-message-modal .fc-edit-message-actions {
    justify-content: flex-end;
}

/* Профиль: удаление аккаунта */
.fc-profile-delete-modal.modal-content h3 {
    color: var(--fc-text) !important;
}

.fc-profile-delete-summary,
.fc-profile-delete-note {
    color: var(--fc-muted);
    line-height: 1.45;
}

.fc-profile-delete-modal .warning {
    color: #c62828;
}

[data-theme="dark"] .fc-profile-delete-modal .warning {
    color: #f87171;
}

.fc-profile-delete-actions {
    flex-wrap: wrap;
    gap: 10px;
}

.fc-profile-delete-actions .btn-secondary {
    background: var(--fc-surface-2);
    color: var(--fc-text);
    border: 1px solid var(--fc-border);
}

/* Профиль: QR-модалка — фон блока QR */
.e2e-pair-modal-content .e2e-pair-hint {
    color: var(--fc-muted) !important;
}

.e2e-pair-modal-content .e2e-pair-qr-wrap {
    background: var(--fc-surface-2) !important;
    border: 1px solid var(--fc-border);
    min-height: 0;
}

.e2e-pair-modal-content.modal-content {
    max-height: min(92dvh, 100vh - 24px);
    overflow-y: auto;
    box-sizing: border-box;
}

.e2e-pair-modal-content .e2e-pair-qr-wrap canvas,
.e2e-pair-modal-content .e2e-pair-qr-wrap img {
    max-width: min(240px, 70vw);
    max-height: min(240px, 38vh);
}

.e2e-pair-modal-content h3 {
    color: var(--fc-text) !important;
}

.e2e-pair-modal-content .e2e-pair-status {
    color: var(--fc-muted);
}

/* Модалка после привязки устройства (пароль): убрать «светлый» текст из style.css */
.modal-content.e2e-pair-post-modal {
    background: var(--fc-surface);
    border: 1px solid var(--fc-border);
    color: var(--fc-text);
}

.modal-content.e2e-pair-post-modal h3 {
    color: var(--fc-text);
}

.e2e-pair-post-modal .e2e-pair-disclaimer-text {
    color: var(--fc-text);
}

.e2e-pair-post-modal .e2e-pair-disclaimer-note,
.e2e-pair-post-modal .e2e-pair-password-hint {
    color: var(--fc-muted);
}

.e2e-pair-post-modal #pairConfirmUsername {
    background: var(--fc-surface-2) !important;
    color: var(--fc-text) !important;
    border: 1px solid var(--fc-border) !important;
}

.e2e-pair-post-modal .form-group label {
    color: var(--fc-muted);
}

.e2e-pair-post-modal input:not([type="submit"]):not([type="button"]) {
    background: var(--fc-input-bg);
    color: var(--fc-text);
    border-color: var(--fc-border);
}

body.page-profile .e2e-pair-device-status {
    color: var(--fc-muted);
}

/* Входящее фото/видео (личный чат): лист действий */
body.page-chat .fc-msg-media-hit {
    display: inline-block;
    max-width: 100%;
    cursor: context-menu;
    border-radius: 12px;
    overflow: hidden;
    vertical-align: top;
}

body.page-chat .fc-msg-media-video-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    vertical-align: top;
    cursor: context-menu;
}

body.page-chat .fc-media-sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
}

/* Лист по ПКМ у фото/видео: панель фиксируется справа от кадра (см. chat-script.js) */
body.page-chat .fc-media-sheet-overlay--anchored {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0;
}

body.page-chat .fc-media-sheet-overlay--anchored .fc-media-sheet-backdrop {
    z-index: 0;
}

body.page-chat .fc-media-sheet-overlay--anchored .fc-media-sheet {
    position: fixed;
    z-index: 1;
    margin-bottom: 0;
    max-height: min(70dvh, calc(100vh - 20px));
}

body.page-chat .fc-media-sheet-overlay[hidden] {
    display: none !important;
}

body.page-chat .fc-media-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.32);
}

[data-theme="dark"] body.page-chat .fc-media-sheet-backdrop {
    background: rgba(0, 0, 0, 0.45);
}

body.page-chat .fc-media-sheet {
    position: relative;
    width: min(360px, 100%);
    max-height: min(70dvh, 520px);
    border-radius: 14px;
    background: var(--fc-surface);
    color: var(--fc-text);
    border: 1px solid var(--fc-border);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.16);
    overflow: hidden;
    margin-bottom: env(safe-area-inset-bottom, 0);
}

[data-theme="dark"] body.page-chat .fc-media-sheet {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

body.page-chat .fc-media-sheet-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border: none;
    border-bottom: 1px solid var(--fc-border);
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.98rem;
    text-align: left;
    cursor: pointer;
}

/* [hidden] alone loses to display:flex above; force hide sheet rows toggled by JS */
body.page-chat .fc-media-sheet-row[hidden] {
    display: none !important;
}

body.page-chat .fc-media-sheet-row:last-child {
    border-bottom: none;
}

body.page-chat .fc-media-sheet-row:hover {
    background: var(--fc-surface-2);
}

body.page-chat .fc-media-sheet-row--danger {
    color: #c62828;
}

body.page-chat .fc-media-sheet-row--danger:hover {
    background: rgba(198, 40, 40, 0.08);
}

[data-theme="dark"] body.page-chat .fc-media-sheet-row--danger {
    color: #f87171;
}

[data-theme="dark"] body.page-chat .fc-media-sheet-row--danger:hover {
    background: rgba(248, 113, 113, 0.12);
}

body.page-chat .fc-media-sheet-ic {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.95;
}

body.page-chat .fc-media-sheet-svg {
    width: 22px;
    height: 22px;
}

body.page-chat .fc-media-sheet-tx {
    flex: 1;
}

/* Подтверждение удаления медиа-сообщения */
body.page-chat .fc-media-del-overlay {
    position: fixed;
    inset: 0;
    z-index: 12010;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

body.page-chat .fc-media-del-overlay[hidden] {
    display: none !important;
}

body.page-chat .fc-media-del-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.38);
}

[data-theme="dark"] body.page-chat .fc-media-del-backdrop {
    background: rgba(0, 0, 0, 0.55);
}

body.page-chat .fc-media-del-panel {
    position: relative;
    width: min(380px, 100%);
    border-radius: 16px;
    padding: 20px 18px 18px;
    background: var(--fc-surface);
    color: var(--fc-text);
    border: 1px solid var(--fc-border);
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
}

[data-theme="dark"] body.page-chat .fc-media-del-panel {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

body.page-chat .fc-media-del-title {
    margin: 0 0 16px;
    font-size: 1.02rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.35;
    /* Глобальный h2 { color: #333 } в style.css иначе перебивает наследование от панели */
    color: var(--fc-text);
    -webkit-text-fill-color: var(--fc-text);
}

body.page-chat .fc-media-del-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 22px;
    cursor: pointer;
    user-select: none;
}

body.page-chat .fc-media-del-cb {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

body.page-chat .fc-media-del-check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-top: 2px;
    border-radius: 50%;
    border: 2px solid var(--fc-border);
    box-sizing: border-box;
    position: relative;
}

body.page-chat .fc-media-del-cb:checked + .fc-media-del-check {
    background: var(--fc-accent, #24a1de);
    border-color: var(--fc-accent, #24a1de);
}

body.page-chat .fc-media-del-cb:checked + .fc-media-del-check::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

body.page-chat .fc-media-del-row-text {
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--fc-text);
}

body.page-chat .fc-media-del-row-text strong {
    font-weight: 600;
}

body.page-chat .fc-media-del-actions {
    display: flex;
    gap: 10px;
}

body.page-chat .fc-media-del-btn {
    flex: 1;
    border: none;
    border-radius: 999px;
    padding: 12px 14px;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

body.page-chat .fc-media-del-btn--muted {
    background: var(--fc-surface-2);
    color: var(--fc-text);
    border: 1px solid var(--fc-border);
}

body.page-chat .fc-media-del-btn--primary {
    background: var(--fc-accent, #24a1de);
    color: #fff;
}

body.page-chat .fc-media-del-btn--muted:hover {
    filter: brightness(1.06);
}

body.page-chat .fc-media-del-btn--primary:hover {
    filter: brightness(1.05);
}

/* Пересылка: полоса над полем ввода */
body.page-chat .fc-forward-compose {
    flex: 1 1 100%;
    width: 100%;
    order: -1;
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0;
    margin: 0 0 8px;
    padding: 10px 12px 10px 10px;
    border-radius: 12px;
    background: rgba(36, 161, 222, 0.12);
    border: 1px solid rgba(36, 161, 222, 0.35);
    box-sizing: border-box;
}

body.page-chat .fc-forward-compose[hidden] {
    display: none !important;
}

body.page-chat .fc-forward-compose-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(51, 144, 236, 0.12);
    color: var(--fc-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

body.page-chat .fc-forward-compose-close:hover {
    background: rgba(51, 144, 236, 0.2);
    color: var(--fc-text);
}

body.page-chat .fc-forward-compose-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    padding-right: 28px;
}

body.page-chat .fc-forward-compose-arrow {
    flex-shrink: 0;
    color: var(--fc-accent, #24a1de);
    width: 22px;
    height: 22px;
}

body.page-chat .fc-forward-compose-arrow svg {
    width: 22px;
    height: 22px;
    display: block;
}

body.page-chat .fc-forward-compose-vbar {
    width: 3px;
    align-self: stretch;
    min-height: 36px;
    border-radius: 2px;
    background: var(--fc-accent, #24a1de);
    flex-shrink: 0;
}

body.page-chat .fc-forward-compose-copy {
    flex: 1;
    min-width: 0;
}

body.page-chat .fc-forward-compose-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--fc-accent, #24a1de);
    line-height: 1.3;
}

body.page-chat .fc-forward-compose-preview {
    margin-top: 4px;
    font-size: 0.88rem;
    color: var(--fc-muted);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.page-chat .fc-forward-compose-preview:empty {
    display: none;
}

/* «Переслано от…» в пузырьке */
body.page-chat .fc-fwd-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-bottom: 8px;
    font-size: 0.88rem;
    line-height: 1.3;
}

body.page-chat .message.other .fc-fwd-head {
    color: var(--fc-bubble-in-text);
}

body.page-chat .message.own .fc-fwd-head {
    color: var(--fc-bubble-out-text);
}

body.page-chat .fc-fwd-head-lab {
    opacity: 0.9;
}

body.page-chat .fc-fwd-av,
body.page-chat .fc-fwd-av-ph {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

body.page-chat .fc-fwd-av-ph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

body.page-chat .message.other .fc-fwd-av-ph {
    background: rgba(51, 144, 236, 0.18);
    color: var(--fc-bubble-in-text);
}

body.page-chat .message.own .fc-fwd-av-ph {
    background: rgba(255, 255, 255, 0.22);
    color: var(--fc-bubble-out-text);
}

body.page-chat .fc-fwd-head-name {
    font-weight: 600;
}

body.page-chat .fc-msg-text-hit {
    cursor: context-menu;
}

/* Модалка выбора чата для пересылки */
body.page-chat .fc-forward-pick-overlay {
    position: fixed;
    inset: 0;
    z-index: 12020;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    box-sizing: border-box;
}

body.page-chat .fc-forward-pick-overlay[hidden] {
    display: none !important;
}

body.page-chat .fc-forward-pick-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
}

[data-theme="dark"] body.page-chat .fc-forward-pick-backdrop {
    background: rgba(0, 0, 0, 0.5);
}

body.page-chat .fc-forward-pick-panel {
    position: relative;
    width: min(400px, 100%);
    max-height: min(72dvh, 560px);
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: var(--fc-surface);
    color: var(--fc-text);
    border: 1px solid var(--fc-border);
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

[data-theme="dark"] body.page-chat .fc-forward-pick-panel {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

body.page-chat .fc-forward-pick-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 14px 10px 16px;
    border-bottom: 1px solid var(--fc-border);
    flex-shrink: 0;
}

body.page-chat .fc-forward-pick-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--fc-text);
}

body.page-chat .fc-forward-pick-x {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--fc-surface-2);
    color: var(--fc-text);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

body.page-chat .fc-forward-pick-x:hover {
    background: var(--fc-border);
}

body.page-chat .fc-forward-pick-list {
    overflow-y: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}

body.page-chat .fc-forward-pick-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
}

body.page-chat .fc-forward-pick-row:hover,
body.page-chat .fc-forward-pick-row:focus-visible {
    background: var(--fc-surface-2);
    outline: none;
}

body.page-chat .fc-forward-pick-av {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--fc-surface-2);
}

body.page-chat .fc-forward-pick-av img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.page-chat .fc-forward-pick-av .fc-chat-initial {
    font-weight: 600;
    font-size: 1rem;
}

body.page-chat .fc-forward-pick-av .fc-chat-emoji-av {
    font-size: 1.35rem;
}

body.page-chat .fc-forward-pick-av .fc-group-av-placeholder--fwd {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
}

body.page-chat .fc-forward-pick-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
