/* Compact overlay — подключается ПОСЛЕ app.css.
   Чтобы откатить дизайн к прежнему, удалите <link> на этот файл в base.html.
   Файл не редактирует app.css: только переопределяет токены и ключевые отступы. */

:root {
    /* Скругления: всё уменьшено пропорционально */
    --sw-radius-xl: 20px;
    --sw-radius-lg: 14px;
    --sw-radius-md: 11px;
    --sw-radius-sm: 9px;

    /* Тени мягче — компактный UI не любит крупных размытий */
    --sw-shadow: 0 14px 38px rgba(17, 26, 54, 0.08);
    --sw-shadow-soft: 0 8px 22px rgba(17, 26, 54, 0.06);
}

/* База: типографика */
body {
    font: 14.5px/1.55 var(--sw-font-body);
}

/* Контейнер */
.site-shell {
    width: min(1120px, calc(100vw - 32px));
    padding: 8px 0 56px;
}

.announcement-bar {
    min-height: 28px;
    padding: 5px 14px;
    font-size: 0.66rem;
    letter-spacing: 0.1em;
}

/* Топбар + навигация */
.topbar {
    gap: 14px;
    padding: 6px 0 2px;
}

.brand {
    gap: 9px;
    font-size: 0.95rem;
}

.main-nav a,
.main-nav summary {
    min-height: 34px;
    padding: 0 11px;
    font-size: 0.84rem;
    box-shadow:
        0 6px 14px rgba(17, 26, 54, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.nav-dropdown-panel {
    padding: 8px;
    border-radius: var(--sw-radius-md);
}

.nav-dropdown-panel a {
    padding: 7px 10px;
    font-size: 0.86rem;
    border-radius: 8px;
}

.nav-badge {
    min-width: 17px;
    height: 17px;
    margin-left: 5px;
    font-size: 0.64rem;
}

/* Кнопки */
.primary-button,
.ghost-button,
.text-button,
.pill {
    min-height: 36px;
    padding: 0 16px;
    font-size: 0.88rem;
}

.primary-button {
    box-shadow:
        0 10px 22px rgba(49, 94, 251, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Hover приподнимает чуть меньше — компактный UI ощущается отзывчивее без скачков */
.ghost-button:hover,
.primary-button:hover,
.pill:hover,
.conversation-link:hover,
.main-nav a:hover {
    transform: translateY(-1px);
}

/* Hero */
.profile-hero {
    gap: 18px;
    border-radius: 22px;
    padding: 20px;
    box-shadow: var(--sw-shadow);
}

.hero {
    padding: 16px 0 10px;
}

.profile-hero-copy h1,
.section-header h1 {
    font-size: clamp(1.55rem, 2.6vw, 2.4rem);
    line-height: 1.08;
}

.section-header {
    margin-bottom: 18px;
    gap: 12px;
}

/* Карточки и поверхности — массово сжимаем большие паддинги.
   Селектор по атрибуту покрывает все inline padding-ы 24/26/28/30/32/34/36px,
   что встречается в этом app.css на ~30+ компонентах. */
[style*="padding: 24px"],
[style*="padding: 28px"],
[style*="padding: 32px"] {
    /* inline-стили не трогаем — это просто placeholder, чтобы держать селектор валидным */
}

/* Базовые карточки/панели */
.profile-card,
.album-card,
.post-card,
.form-card,
.section-card,
.sidebar-card,
.discover-box,
.split-panel,
.appearance-panel,
.public-chat-card,
.info-page-item,
.chat-login-card {
    border-radius: var(--sw-radius-lg);
}

.public-chat-card {
    padding: 20px;
}

.public-chat-card-head {
    margin-bottom: 14px;
    gap: 12px;
}

.public-chat-card-head h2 {
    font-size: clamp(1.25rem, 2vw, 1.7rem);
    line-height: 1.08;
}

.public-chat-form input,
.public-chat-form .rich-editor-surface {
    min-height: 46px;
    border-radius: 12px;
}

.public-chat-form .primary-button {
    min-width: 110px;
}

.chat-login-card {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 14px;
}

.public-chat-stream {
    gap: 12px;
    max-height: 380px;
}

.chat-message {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
}

.site-chat-stream .chat-message {
    padding: 11px 0;
}

.chat-avatar img {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(49, 94, 251, 0.1);
    box-shadow: 0 6px 14px rgba(17, 26, 54, 0.06);
}

.chat-message-body p {
    margin: 4px 0 0;
    font-size: 0.92rem;
    line-height: 1.55;
}

.chat-message-head strong {
    font-size: 0.94rem;
}

.community-chat-page {
    gap: 14px;
    padding: 18px;
    min-height: calc(100vh - 160px);
}

.community-chat-header p {
    font-size: 0.92rem;
}

/* Сетки */
.card-grid {
    gap: 14px;
}

.two-column {
    grid-template-columns: 260px minmax(0, 1fr);
}

.info-page-grid {
    gap: 10px;
}

.info-page-item {
    min-height: 110px;
    padding: 13px;
    border-radius: 16px;
    gap: 8px;
}

.info-page-lead {
    font-size: 0.98rem;
    line-height: 1.6;
}

.info-page-text {
    gap: 10px;
    margin: 12px 0 16px;
}

.info-page-text p {
    font-size: 0.93rem;
    line-height: 1.6;
}

.info-page-related-card {
    min-height: 84px;
    padding: 12px;
    gap: 6px;
}

.photo-rules-content {
    gap: 18px;
}

.photo-rules-section {
    gap: 10px;
}

.photo-rules-section h2 {
    font-size: 1.15rem;
}

.photo-rules-section h3 {
    font-size: 0.98rem;
}

.photo-rules-section p {
    line-height: 1.6;
}

/* Профиль/иконки/мелочи */
.profile-summary-badge {
    font-size: 0.7rem;
}

.detail-grid {
    gap: 8px;
}

/* Аватары и медиа: убираем гигантские круги, оставляя пропорции */
.profile-hero-media img:first-child {
    border-radius: var(--sw-radius-lg);
}

/* Чуть менее «толстые» секционные заголовки */
.section-title-row {
    margin-bottom: 12px;
}

/* ======================================================================
   ПРОХОД 2 — точечно по «крупным» местам в скриншотах.
   ====================================================================== */

/* Главный заголовок страницы (Общий чат / Встречи / Стена / Hero…).
   Базовый clamp в app.css — 2.9rem…5rem. Сжимаем единым правилом. */
.hero-copy h1,
.section-header h1,
.profile-hero-copy h1,
.editorial-copy h2 {
    margin: 0 0 10px;
    font-size: clamp(1.55rem, 2.6vw, 2.4rem);
    line-height: 1.08;
}

/* Eyebrow — мельче и плотнее */
.eyebrow {
    margin-bottom: 8px;
    font-size: 0.66rem;
    letter-spacing: 0.14em;
}

/* Стеклянные карточки и feature-card — крупный padding 30px → 18px */
.glass-card,
.feature-card,
.post-card {
    padding: 18px;
    border-radius: var(--sw-radius-lg);
}

/* Стена (Моя стена) */
.wall-section-card .section-header {
    margin-bottom: 12px;
}

.wall-section-card h2 {
    margin: 0;
    font-size: 1.05rem;
}

.wall-post-list {
    gap: 12px;
}

.post-card {
    padding: 14px;
}

.post-head {
    gap: 10px;
}

.post-image,
.post-video {
    max-height: 360px;
    margin: 10px 0;
    border-radius: 14px;
}

.comment-list {
    gap: 8px;
    margin: 10px 0;
}

.post-meta-actions {
    gap: 8px;
    margin: 6px 0 4px;
}

.small-action-button {
    min-height: 32px;
    padding: 0 12px;
    font-size: 0.84rem;
}

.icon-action-button {
    width: 32px;
    height: 32px;
    font-size: 0.96rem;
}

/* Вкладки .tab-row (фото / клубы / форум / блог / комментарии и подобные) */
.tab-row {
    margin-bottom: 12px;
}

.tab-row a,
.tab-row button,
.tab-row span {
    padding: 6px 11px;
    font-size: 0.85rem;
}

.community-tab-row {
    max-width: 560px;
    margin: -4px 0 14px;
    padding: 4px;
}

.community-tab-row a {
    min-width: 100px;
    flex: 1 1 100px;
}

/* Profile section nav (фото / клубы / встречи / форум / блог / комментарии)
   и list rows (Мои темы, Комментарий на стене и т.п.) */
.profile-section-nav {
    gap: 5px;
    margin: 10px 0 14px;
    padding: 7px;
    border-radius: 16px;
}

.profile-section-nav > a,
.profile-more-actions summary {
    min-height: 30px;
    padding: 0 10px;
    font-size: 0.84rem;
    gap: 5px;
}

.profile-section-nav span {
    font-size: 0.72rem;
}

.profile-section-row {
    gap: 12px;
    padding: 13px 16px;
}

.profile-section-row h2 {
    margin: 2px 0 5px;
    font-size: 1.02rem;
    line-height: 1.18;
}

.profile-section-meta,
.profile-section-date {
    gap: 4px;
    font-size: 0.84rem;
}

/* Карточки анкет в discover (Федор / Иван и Аня) */
.profile-card {
    padding: 14px;
}

.card-cover {
    aspect-ratio: 1.3;
    border-radius: 14px;
    margin-bottom: 10px;
}

.profile-card h2 {
    margin: 0 0 4px;
    font-size: 1.05rem;
    line-height: 1.15;
}

.profile-card p {
    font-size: 0.86rem;
    line-height: 1.45;
}

/* Альбомные карточки — туда же */
.album-card {
    padding: 14px;
}

.album-card h2 {
    font-size: 1rem;
}

/* Встречи: верхняя CTA-полоса «+ Добавить встречу», карточка встречи */
.club-events-page-card {
    gap: 12px;
}

.club-event-list,
.club-subscriber-list {
    gap: 12px;
}

.club-event-status-tabs {
    gap: 18px;
    padding-bottom: 8px;
}

.club-event-status-tabs a,
.club-event-status-tabs span {
    min-height: 30px;
    font-size: 0.92rem;
}

.club-event-status-tabs small {
    min-width: 20px;
    min-height: 20px;
    padding: 0 6px;
    font-size: 0.72rem;
}

.club-event-add-panel {
    gap: 10px;
    min-height: 56px;
    border-radius: 14px;
    font-size: 0.96rem;
    font-weight: 700;
}

.club-event-add-icon {
    width: 24px;
    height: 24px;
    font-size: 1.1rem;
}

.club-event-card {
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 14px;
    padding: 12px;
    border-radius: 16px;
}

.club-event-media img {
    border-radius: 12px;
}

.club-event-copy {
    gap: 7px;
}

.club-event-copy h2 {
    font-size: 1.1rem;
    line-height: 1.18;
}

.club-event-card-meta,
.club-event-footer,
.club-event-date-line,
.club-event-place-line {
    gap: 7px;
}

.club-event-card-meta span:not(.eyebrow),
.club-event-footer span,
.club-event-place-line span {
    min-height: 22px;
    padding: 0 8px;
    font-size: 0.76rem;
}

/* «Пустые» состояния (например, "Сообщений пока нет") */
.club-empty-state,
.social-empty-state {
    padding: 14px 16px;
    border-radius: 14px;
}

.club-empty-state h3 {
    font-size: 1rem;
}

.club-empty-state p,
.social-empty-state p {
    font-size: 0.88rem;
    margin: 4px 0 0;
}

/* Общий чат — внутри community-chat-page и его topline */
.community-chat-page {
    padding: 14px;
    gap: 12px;
    min-height: auto;
}

.community-chat-topline {
    gap: 10px;
}

.community-chat-topline h2 {
    font-size: 1rem;
    margin: 0;
}

.community-chat-form textarea {
    min-height: 70px;
}

/* Discover: фильтры поиска (большая карточка с чекбоксами, селектами, кнопками) */
.discover-page {
    gap: 14px;
}

.discover-filter-summary {
    min-height: 52px;
    padding: 10px 16px;
    gap: 12px;
}

.discover-filter-summary strong {
    font-size: 0.96rem;
}

.discover-filter-summary small {
    font-size: 0.8rem;
}

.discover-filter-summary-action {
    min-height: 32px;
    padding: 0 12px;
    font-size: 0.84rem;
}

.discover-filter-top,
.discover-filter-grid,
.advanced-search,
.discover-actions {
    padding: 14px 16px;
}

.discover-filter-top {
    grid-template-columns: minmax(240px, 1fr) 280px;
    gap: 14px;
}

.discover-filter-card select,
.discover-filter-card input {
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 12px;
}

.discover-filter-card select {
    padding-right: 38px;
    background-position: right 12px center;
}

.discover-filter-top label,
.discover-box h3,
.range-row > span {
    font-size: 0.9rem;
}

.discover-box {
    gap: 10px;
    padding: 14px;
    border-radius: 16px;
}

.discover-box-params {
    padding: 14px;
    border-radius: 16px;
}

.discover-box-params .check-row {
    min-height: 34px;
}

.discover-inline-grid {
    gap: 10px;
}

.check-row {
    gap: 10px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 0.9rem;
}

.check-row input[type="checkbox"] {
    width: 17px;
    height: 17px;
    border-radius: 6px;
}

.unit-field {
    grid-template-columns: minmax(0, 1fr) 64px;
}

.range-row {
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 14px;
}

.range-pair {
    gap: 10px;
}

.discover-submit {
    min-width: 150px;
    min-height: 38px;
    font-size: 0.92rem;
}

.save-filter-button,
.delete-filter-button {
    min-height: 34px;
    font-size: 0.84rem;
}

.advanced-search summary {
    padding-top: 16px;
    font-size: 0.9rem;
}

.advanced-grid {
    padding-top: 14px;
    padding-bottom: 12px;
    margin-bottom: 12px;
}

/* Общие глобальные input/textarea/select — узнаваемо плотнее */
input,
textarea {
    padding: 8px 12px;
    border-radius: 12px;
    min-height: 36px;
}

select {
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    padding: 0 36px 0 12px;
    border-radius: 12px;
}

select[multiple] {
    height: auto;
    max-height: none;
    padding: 8px 12px;
}

label {
    font-size: 0.86rem;
}

/* Опросы — компактнее + убираем белый фон у активной вкладки.
   Активную «плитку» создаёт глобальное правило .tab-active из app.css,
   которое наложилось поверх правильного синего подчёркивания. */
.poll-page {
    gap: 14px;
}

.poll-page-header .muted {
    margin: -2px 0 0;
    font-size: 0.92rem;
}

.poll-status-tabs {
    gap: 22px;
}

.poll-status-tabs a {
    min-height: 36px;
    padding: 0 0 8px;
    border-bottom-width: 2px;
    font-size: 1rem;
    font-weight: 700;
}

.poll-status-tabs a.tab-active {
    background: transparent;
    border-color: transparent;
    border-bottom-color: var(--sw-accent);
    box-shadow: none;
}

.poll-category-pills {
    gap: 6px;
}

.poll-category-pills a {
    min-height: 28px;
    padding: 0 10px;
    font-size: 0.82rem;
}

.poll-list {
    gap: 12px;
}

.poll-list-card {
    grid-template-columns: minmax(0, 1fr) 110px;
    gap: 12px 16px;
    padding: 14px;
    border-radius: 16px;
}

.poll-list-card-copy {
    gap: 6px;
}

.poll-list-card h2 {
    font-size: 1.1rem;
    line-height: 1.18;
}

/* Тот же фокс — все «underline-tabs», где активный таб не должен быть плиткой */
.club-event-status-tabs .tab-active,
.club-event-status-tabs a.tab-active {
    background: transparent;
    box-shadow: none;
    border-color: transparent;
}

/* Пагинация */
.pagination-row {
    gap: 10px;
}

.pagination-status {
    font-size: 0.86rem;
}

/* ======================================================================
   ПРОХОД 3 — посты ещё компактнее + z-index для дропдауна анкеты.
   ====================================================================== */

/* Дропдаун ⋮ у профильной карточки/строки уходил за соседние карточки.
   Причина — соседи создавали свои стэк-контексты (transform на hover).
   Поднимаем открытый details и его панель, плюс саму карточку с раскрытым
   меню — выше остальных. */
.profile-more-actions {
    position: relative;
    z-index: 30;
}

.profile-more-actions[open] {
    z-index: 200;
}

.profile-more-actions-panel {
    z-index: 200;
}

/* Карточка/строка, в которой раскрыто меню — поверх соседей */
.profile-card:has(.profile-more-actions[open]),
.profile-section-row:has(.profile-more-actions[open]),
.profile-hero:has(.profile-more-actions[open]),
.glass-card:has(.profile-more-actions[open]),
.post-card:has(.profile-more-actions[open]) {
    position: relative;
    z-index: 150;
    isolation: isolate;
}

/* Посты — ещё мельче */
.post-card {
    padding: 10px 12px;
    border-radius: 14px;
}

.post-head strong {
    font-size: 0.92rem;
}

.post-head .muted {
    font-size: 0.78rem;
}

.post-card > p {
    margin: 6px 0;
    font-size: 0.92rem;
    line-height: 1.45;
}

.post-image,
.post-video {
    max-height: 360px;
    margin: 8px 0;
    border-radius: 12px;
    object-fit: contain;
    background: linear-gradient(180deg, rgba(17, 26, 54, 0.05), rgba(17, 26, 54, 0.09));
    cursor: zoom-in;
    transition: filter 160ms ease;
}

.post-image:hover {
    filter: brightness(0.96);
}

/* Лайтбокс под пост-изображения */
.wall-image-lightbox {
    width: min(960px, calc(100vw - 24px));
    max-width: min(960px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: transparent;
    box-shadow: 0 30px 80px rgba(7, 17, 31, 0.5);
    overflow: visible;
}

.wall-image-lightbox::backdrop {
    background: rgba(7, 17, 31, 0.78);
    backdrop-filter: blur(4px);
}

.wall-image-lightbox-body {
    position: relative;
    background: #0c1322;
    border-radius: 20px;
    overflow: hidden;
    display: grid;
    place-items: center;
    min-height: 240px;
}

.wall-image-lightbox-body img,
.wall-image-lightbox-body video {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 24px);
    object-fit: contain;
    background: #0c1322;
}

.wall-image-lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(15, 23, 42, 0.6);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.wall-image-lightbox-close:hover {
    background: rgba(15, 23, 42, 0.86);
}

.post-meta-actions {
    gap: 6px;
    margin: 4px 0 2px;
}

.small-action-button {
    min-height: 28px;
    padding: 0 10px;
    font-size: 0.78rem;
}

.icon-action-button {
    width: 28px;
    height: 28px;
    font-size: 0.86rem;
}

.post-meta-actions .muted,
.post-card .muted {
    font-size: 0.78rem;
}

.comment-list {
    gap: 6px;
    margin: 8px 0;
}

.comment-row {
    gap: 8px;
    font-size: 0.86rem;
}

/* Inline-форма комментария под постом — узкая полоса */
.inline-form {
    display: grid;
    gap: 6px;
    margin: 6px 0 0;
}

.inline-form .rich-editor-toolbar {
    margin-bottom: 0;
}

.inline-form .rich-editor-surface {
    min-height: 56px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.9rem;
}

.inline-form .ghost-button {
    min-height: 30px;
    padding: 0 12px;
    font-size: 0.84rem;
    justify-self: start;
}

.inline-form p {
    gap: 6px;
}

/* Универсально прячем имена прикреплённых файлов — длинные имена
   уродуют чипы загрузки. Оставляем только индикатор/иконку. */
.club-file-name,
[data-club-file-name],
[data-event-comment-file-name],
[data-article-comment-file-name],
[data-blog-comment-file-name],
[data-community-chat-file-name],
[data-swing-article-file-name],
[data-blog-file-name] {
    display: none !important;
}

/* В чипе «📎 Прикрепить изображение» после выбора файла JS подставляет
   имя файла. Перекрываем — показываем «Файл прикреплён». */
.attached-file-chip[data-has-file="true"] .attached-file-chip-label {
    font-size: 0;
    position: relative;
    min-width: 150px;
}

.attached-file-chip[data-has-file="true"] .attached-file-chip-label::after {
    content: "Файл прикреплён";
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--sw-text);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 12px;
    white-space: nowrap;
}

/* Тулбар rich-editor: имя файла больше не подставляется (см. rich-editor.js).
   На случай старого кэша — ограничиваем ширину и обрезаем длинный текст.
   Когда файл выбран — кнопка получает data-has-file="true" → лёгкая
   акцентная подсветка как индикатор. */
.rich-editor-attachment {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rich-editor-attachment[data-has-file="true"] {
    background: rgba(33, 195, 154, 0.16) !important;
    color: #0e8c63 !important;
    border-color: rgba(33, 195, 154, 0.32) !important;
}

/* Форма регистрации/редактирования профиля — радио и чекбоксы.
   Базовые правила в app.css делают каждый вариант плиткой с фоном и большим
   паддингом. Убираем фон/обводку/тень и поджимаем шаг между опциями. */
.registration-choice-list ul {
    gap: 4px;
}

.registration-choice-list > div,
.registration-choice-list li {
    margin: 0;
}

.registration-choice-list > div label,
.registration-choice-list li label {
    min-height: auto;
    padding: 4px 0;
    gap: 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-weight: 500;
    line-height: 1.3;
}

.registration-choice-list > div input[type="radio"],
.registration-choice-list > div input[type="checkbox"],
.registration-choice-list input[type="radio"],
.registration-choice-list input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    top: 0;
}

/* «Я согласен с условиями» — тоже без плитки */
.registration-terms {
    padding: 6px 0;
    gap: 8px;
    border: 0;
    background: transparent;
}

.registration-terms input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* Заголовки/строки сетки чуть плотнее */
.registration-row {
    gap: 10px;
}

.registration-grid {
    gap: 12px;
}

/* Бейдж «Создатель» у клубов в активити профиля.
   Маленькая пилюля в строку с eyebrow — окрашена фирменным coral. */
.profile-section-badge {
    display: inline-flex;
    align-items: center;
    height: 18px;
    margin-left: 8px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: middle;
}

.profile-section-badge-owner {
    background: linear-gradient(135deg, rgba(109, 74, 245, 0.12), rgba(255, 93, 122, 0.14));
    color: var(--sw-color-coral, #ff5d7a);
    border: 1px solid rgba(255, 93, 122, 0.28);
}

/* Модалка фото (анкета + клуб) — поджимаем сайдбар, чтобы лента комментариев
   реально была видна, а не зажата под формой ввода. */
.photo-viewer-side {
    padding: 12px 14px;
    gap: 10px;
}

.photo-side-top {
    gap: 8px;
    padding-bottom: 4px;
}

.photo-side-head {
    gap: 8px;
}

.photo-owner-meta {
    gap: 8px;
}

.photo-owner-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
}

.photo-owner-link {
    font-size: 0.92rem;
}

.photo-side-meta p {
    font-size: 0.85rem;
    line-height: 1.35;
}

.photo-stats-bar {
    gap: 10px;
}

.photo-stats-bar .photo-stat-item {
    font-size: 0.84rem;
}

.photo-stats-bar .icon-action-button {
    width: 26px;
    height: 26px;
    font-size: 0.82rem;
}

.photo-comment-list {
    gap: 6px;
    padding-right: 4px;
}

.photo-comment-item {
    padding: 6px 0;
    gap: 2px;
}

.photo-comment-avatar {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
}

.photo-comment-head {
    gap: 8px;
}

.photo-comment-author {
    font-size: 0.88rem;
}

.photo-comment-content p {
    font-size: 0.88rem;
    line-height: 1.35;
}

.photo-comment-delete-button {
    font-size: 0.86rem;
}

/* Форма ввода — самое жадное место. Сжимаем поле и кнопку. */
.photo-comment-form {
    padding-top: 6px;
    gap: 6px;
    display: grid;
}

.photo-comment-form .rich-editor-toolbar {
    margin-bottom: 0;
    padding: 2px 4px;
}

.photo-comment-form .rich-editor-toolbar button {
    min-height: 24px;
    padding: 0 8px;
    font-size: 0.78rem;
}

.photo-comment-form .rich-editor-surface {
    min-height: 56px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.88rem;
}

.photo-comment-form .primary-button {
    min-height: 32px;
    padding: 0 14px;
    font-size: 0.86rem;
}

/* Превью прикреплённого файла в форме поста клуба.
   Маленькая плашка с миниатюрой, подписью «Файл прикреплён» и крестиком ✕,
   чтобы пользователь видел что прикреплено и мог отменить до отправки. */
.club-post-attachment-preview {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 6px 6px;
    border: 1px solid rgba(33, 195, 154, 0.32);
    border-radius: 999px;
    background: rgba(33, 195, 154, 0.1);
    color: #0e8c63;
    font-size: 0.84rem;
    font-weight: 600;
    width: fit-content;
    max-width: 100%;
}

.club-post-attachment-preview[hidden] {
    display: none !important;
}

.club-post-attachment-preview img {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 999px;
    border: 1px solid rgba(33, 195, 154, 0.32);
    background: rgba(255, 255, 255, 0.6);
}

.club-post-attachment-preview img[hidden] {
    display: none !important;
}

.club-post-attachment-meta {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.club-post-attachment-remove {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 0;
    background: rgba(255, 255, 255, 0.85);
    color: #0e8c63;
    font-size: 0.86rem;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.club-post-attachment-remove:hover {
    background: #fff;
    color: var(--sw-color-coral, #ff5d7a);
}

/* Модалка просмотра аватарок клуба — компонует как у анкеты:
   слева изображение со стрелками-навигацией, справа сайдбар с инфо клуба. */
.club-avatar-modal {
    width: min(1200px, calc(100vw - 32px));
    max-width: min(1200px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 0;
    border: 0;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(7, 17, 31, 0.4);
    overflow: hidden;
}

.club-avatar-modal::backdrop {
    background: rgba(7, 17, 31, 0.72);
    backdrop-filter: blur(4px);
}

.club-avatar-modal-body {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, 360px);
    gap: 0;
    position: relative;
    max-height: calc(100vh - 32px);
}

.club-avatar-modal-image-wrap {
    position: relative;
    background: #0c1322;
    display: grid;
    place-items: center;
    min-height: 320px;
    overflow: hidden;
}

.club-avatar-modal-image {
    width: 100%;
    height: 100%;
    max-height: calc(100vh - 32px);
    object-fit: contain;
    display: block;
}

.club-avatar-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(15, 23, 42, 0.6);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.club-avatar-modal-nav:hover { background: rgba(15, 23, 42, 0.86); }
.club-avatar-modal-prev { left: 14px; }
.club-avatar-modal-next { right: 14px; }

.club-avatar-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    z-index: 2;
    background: transparent;
    border: 0;
    color: var(--sw-text-soft);
    font-weight: 600;
    cursor: pointer;
    padding: 6px 8px;
}

.club-avatar-modal-aside {
    padding: 22px 22px;
    display: grid;
    align-content: start;
    gap: 12px;
    background: #fff;
}

.club-avatar-modal-aside header {
    display: grid;
    gap: 2px;
    padding-right: 32px;
}

.club-avatar-modal-aside header strong {
    font-size: 1.05rem;
}

.club-avatar-modal-aside header span {
    font-size: 0.8rem;
}

@media (max-width: 720px) {
    .club-avatar-modal-body {
        grid-template-columns: minmax(0, 1fr);
    }
    .club-avatar-modal-aside {
        padding: 14px 16px;
    }
}

/* Модалка управления пригласительными токенами приватного клуба */
.club-invite-tokens-dialog .club-invite-body {
    display: grid;
    gap: 10px;
    padding: 14px 16px;
}

.club-invite-token-create {
    display: flex;
    gap: 8px;
    margin: 0 0 8px;
}

.club-invite-token-create input[type="text"] {
    flex: 1;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 10px;
}

.club-invite-tokens-list {
    display: grid;
    gap: 8px;
}

.club-invite-token-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--sw-border);
    background: rgba(255, 255, 255, 0.74);
}

.club-invite-token-info {
    display: grid;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.club-invite-token-info strong {
    font-size: 0.9rem;
}

.club-invite-token-info small {
    font-size: 0.72rem;
}

.club-invite-token-info code {
    font-size: 0.74rem;
    color: var(--sw-text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.club-invite-token-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Бейдж количества заявок у пункта меню «Заявки» в клубном сайдбаре */
.club-menu-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: auto;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--sw-color-coral, #ff5d7a);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

/* Страница «Сообщения» — фиксируем высоту чата в высоту окна,
   внутри прокручивается только лента сообщений. Без этого при большом
   количестве сообщений вся страница растягивается в бесконечную портянку. */
.messages-layout [data-message-shell] {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    height: calc(100vh - 180px);
    max-height: calc(100vh - 180px);
    gap: 12px;
}

.messages-layout .message-thread {
    overflow-y: auto;
    overscroll-behavior: contain;
    min-height: 0;
    padding-right: 4px;
    gap: 10px;
}

.messages-layout [data-message-shell] form {
    margin: 0;
}

.messages-layout .sidebar-card {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

/* На узких экранах две колонки давят чат — складываем в один столбик.
   Диалоги становятся горизонтальной полосой-скроллом сверху, чат — на всю ширину. */
@media (max-width: 860px) {
    .messages-layout {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px;
    }

    .messages-layout .sidebar-card {
        position: static;
        max-height: none;
        overflow: visible;
        padding: 10px 12px;
    }

    .messages-layout .sidebar-card h2 {
        font-size: 0.92rem;
        margin: 0 0 8px;
    }

    .messages-layout .conversation-list {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        padding-bottom: 4px;
        margin: 0;
        scroll-snap-type: x mandatory;
    }

    .messages-layout .conversation-link {
        flex: 0 0 auto;
        min-width: 168px;
        max-width: 220px;
        scroll-snap-align: start;
        padding: 8px 10px;
        border-radius: 12px;
    }

    .messages-layout .conversation-link strong {
        font-size: 0.9rem;
    }

    .messages-layout .conversation-link .muted {
        font-size: 0.78rem;
    }

    .messages-layout [data-message-shell] {
        height: calc(100vh - 260px);
        max-height: calc(100vh - 260px);
        padding: 12px;
    }
}

/* Общий чат: ровно та же логика, что у личных сообщений — фиксируем
   высоту контейнера в высоту окна, внутри прокручивается только лента,
   форма ввода прижата к низу. */
.community-chat-page {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: calc(100vh - 180px);
    max-height: calc(100vh - 180px);
}

.community-chat-stream {
    overflow-y: auto;
    overscroll-behavior: contain;
    min-height: 0;
    padding-right: 4px;
}

.community-chat-form {
    margin: 0;
}

@media (max-width: 860px) {
    .community-chat-page {
        height: calc(100vh - 200px);
        max-height: calc(100vh - 200px);
    }
}

@media (max-width: 480px) {
    .community-chat-page {
        height: calc(100vh - 180px);
        max-height: calc(100vh - 180px);
    }
}

/* Самые узкие — телефон в портретной */
@media (max-width: 480px) {
    .messages-layout [data-message-shell] {
        height: calc(100vh - 240px);
        max-height: calc(100vh - 240px);
        padding: 10px;
    }

    .messages-layout .message-bubble {
        max-width: 92%;
    }
}

/* Шапка профиля с пользовательской картинкой.
   В app.css поверх фоновой картинки лежит градиент
   linear-gradient(120deg, rgba(18,41,61,.86), rgba(66,31,90,.78), rgba(11,31,67,.86)) —
   из-за середины (66,31,90) ЛЮБОЙ фон уходит в фиолетовый.
   Меняем на нейтральную тёмную вуаль: фото остаётся читаемым,
   контраст для белого текста по-прежнему ок. */
.profile-hero.has-profile-background {
    background:
        linear-gradient(180deg, rgba(10, 16, 28, 0.42), rgba(10, 16, 28, 0.58)),
        var(--profile-background-image) center / cover no-repeat;
}

/* Модалка добавления поста — composer должен быть виден.
   На случай, если правила выше что-то слишком зажали. */
.wall-post-composer {
    display: grid;
    gap: 6px;
}

.wall-post-composer .rich-editor-surface {
    min-height: 100px;
}

.wall-post-form {
    gap: 10px;
}

.wall-post-toolbar {
    gap: 10px;
}

/* Сама модалка — поплотнее */
.upload-dialog {
    width: min(640px, calc(100vw - 24px));
    border-radius: 20px;
    padding: 12px 16px 16px;
}

.upload-dropzone {
    padding: 22px 16px;
    border-radius: 18px;
    gap: 6px;
}

.upload-dropzone h2 {
    font-size: 1.1rem;
}

.upload-dropzone-icon {
    font-size: 1.8rem;
}

/* Мобильный — оставляем приятный воздух, но всё равно компактнее */
@media (max-width: 720px) {
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    .site-shell {
        width: calc(100vw - 20px);
        padding: 6px 0 44px;
    }
    .profile-hero {
        padding: 16px;
        border-radius: 18px;
    }
    .public-chat-card,
    .community-chat-page {
        padding: 14px;
    }
}
