* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    position: relative;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* Фикс для Firefox */
@-moz-document url-prefix() {
    html, body {
        height: 100vh;
        height: -moz-available;
        height: stretch;
    }
    .container {
        height: 100vh;
        height: -moz-available;
        height: stretch;
    }
}

.container {
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ========== СТИЛИ ДЛЯ ЛОГИНА ========== */
.login-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h2 {
    margin-bottom: 10px;
    color: #333;
    font-size: 28px;
}

.login-card .subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.login-card input {
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.login-card input:focus {
    outline: none;
    border-color: #667eea;
}

.login-card button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    margin-top: 10px;
}

.login-card button:hover {
    transform: translateY(-2px);
}

.error-message {
    color: #e74c3c;
    margin-top: 15px;
    font-size: 14px;
}

.register-link {
    margin-top: 20px;
    font-size: 14px;
    color: #667eea;
    cursor: pointer;
}

.register-link:hover {
    text-decoration: underline;
}

.register-agreements {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 6px 0 4px;
    text-align: left;
}

.agreement-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    color: #3a3f52;
    font-size: 14px;
    line-height: 1.45;
}

.agreement-checkbox input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.agreement-checkbox-mark {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    margin-top: 1px;
    border-radius: 7px;
    border: 2px solid rgba(102, 126, 234, 0.28);
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(243,245,255,0.96) 100%);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.10);
    position: relative;
    transition: all 0.2s ease;
}

.agreement-checkbox input:checked + .agreement-checkbox-mark {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(102, 126, 234, 0.22);
}

.agreement-checkbox input:checked + .agreement-checkbox-mark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.agreement-checkbox input:focus-visible + .agreement-checkbox-mark,
.agreement-checkbox:hover .agreement-checkbox-mark {
    border-color: rgba(102, 126, 234, 0.55);
    box-shadow: 0 8px 18px rgba(102, 126, 234, 0.16);
}

.agreement-checkbox-text {
    flex: 1;
}

.agreement-checkbox-text a {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
}

.agreement-checkbox-text a:hover {
    text-decoration: underline;
}

/* ========== СТИЛИ ДЛЯ ЧАТА ========== */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    min-height: 0;
}

/* Верхняя панель */
.top-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo span {
    font-size: 24px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.15);
    padding: 6px 12px;
    border-radius: 30px;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: white;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

/* Строка с селектором чата и кнопкой настроек */
.space-selector-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 8px 16px;
    flex-shrink: 0;
}

.space-selector {
    flex: 1;
    background: transparent;
    border-bottom: none;
    padding: 0;
}

.current-space {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.current-space:active {
    background: #e8e9ea;
}

.space-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.space-icon {
    font-size: 20px;
}

.space-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.space-count {
    font-size: 12px;
    color: #999;
    margin-left: 8px;
}

.dropdown-icon {
    font-size: 18px;
    color: #999;
}

.spaces-dropdown {
    display: none;
    background: white;
    border-radius: 12px;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
}

.spaces-dropdown.show {
    display: block;
}

.space-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.space-option:active {
    background: #f5f5f5;
}

.space-option.active {
    background: linear-gradient(135deg, rgba(102,126,234,0.1) 0%, rgba(118,75,162,0.1) 100%);
    border-left: 3px solid #667eea;
}

.space-option-name {
    font-size: 14px;
    color: #333;
}

.space-option-members {
    font-size: 12px;
    color: #999;
}

.empty-spaces {
    text-align: center;
    padding: 20px;
    color: #999;
}

.space-settings-btn {
    background: #f0f0f0;
    border: none;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.space-settings-btn:hover {
    background: #e0e0e0;
}

.space-settings-btn:active {
    transform: scale(0.95);
}

/* Область сообщений */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
}

.message {
    display: flex;
    animation: slideIn 0.3s ease;
}

.message.user1 {
    justify-content: flex-start;
}

.message.user2 {
    justify-content: flex-end;
}

.message-content {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
}

.user1 .message-content {
    background: white;
    border: 1px solid #e0e0e0;
}

.user2 .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-header {
    font-size: 11px;
    margin-bottom: 4px;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 6px;
}

.message-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-avatar:active {
    transform: scale(0.95);
}

.user2 .message-header {
    justify-content: flex-end;
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-photo {
    margin-top: 6px;
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
    cursor: pointer;
}

.message-time {
    font-size: 9px;
    margin-top: 4px;
    opacity: 0.5;
    text-align: right;
}

/* Стили для ответа */
.reply-preview {
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid #667eea;
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 8px;
    font-size: 12px;
}

.user2 .reply-preview {
    background: rgba(255, 255, 255, 0.2);
    border-left-color: white;
}

.reply-header {
    font-size: 11px;
    opacity: 0.7;
    margin-bottom: 2px;
}

.reply-text {
    font-size: 11px;
    opacity: 0.8;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Блок предпросмотра ответа в области ввода */
.reply-preview-container {
    background: #f0f0f0;
    border-radius: 12px;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-left: 3px solid #667eea;
}

.reply-preview-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.reply-preview-text {
    flex: 1;
    font-size: 12px;
    color: #666;
    word-break: break-word;
}

.reply-preview-text strong {
    color: #667eea;
}

.cancel-reply-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
    transition: color 0.2s;
}

.cancel-reply-btn:hover {
    color: #e74c3c;
}

.loading-messages {
    text-align: center;
    color: #999;
    padding: 20px;
}

.loading-indicator {
    text-align: center;
    color: #999;
    padding: 20px;
    font-size: 14px;
}

/* ========== ОБЛАСТЬ ВВОДА ========== */
.input-area {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 12px;
    flex-shrink: 0;
}

.message-input-wrapper {
    margin-bottom: 10px;
}

.message-input-wrapper textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.4;
    resize: none;
    background: #f8f9fa;
    transition: all 0.2s ease;
}

.message-input-wrapper textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.message-input-wrapper textarea::placeholder {
    color: #999;
    font-weight: 400;
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}


.emoji-toggle-btn {
    background: #f0f0f0;
    border: none;
    width: 48px;
    min-width: 48px;
    height: 48px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.emoji-toggle-btn:active {
    background: #e0e0e0;
    transform: scale(0.98);
}

.emoji-picker {
    display: none;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 10px;
    margin-top: 8px;
}

.emoji-picker.show {
    display: block;
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 8px;
}

.emoji-picker-btn {
    border: none;
    background: white;
    border-radius: 12px;
    min-height: 40px;
    font-size: 22px;
    cursor: pointer;
}

.emoji-picker-btn:active {
    transform: scale(0.96);
}

.photo-label {
    background: #f0f0f0;
    padding: 12px 20px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #666;
}

.photo-label:active {
    background: #e0e0e0;
    transform: scale(0.98);
}

.send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    flex: 8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

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

.send-btn:disabled {
    opacity: 0.6;
    transform: none;
    cursor: not-allowed;
}

.photo-preview {
    margin-top: 10px;
    position: relative;
    display: inline-block;
}

.photo-preview img {
    max-width: 60px;
    max-height: 60px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.photo-preview button {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.photo-preview button:active {
    transform: scale(0.9);
}

/* Прогресс бар для оптимизации */
.optimize-progress {
    background: #e0e0e0;
    border-radius: 20px;
    height: 4px;
    overflow: hidden;
    margin-top: 8px;
    width: 100%;
}

.optimize-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.2s ease;
}

.optimize-text {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    text-align: center;
}

/* Action Sheet стили */
.action-sheet-overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.action-sheet-overlay.show {
    display: block;
}

.action-sheet {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    animation: slideUp 0.3s ease;
}

.action-sheet.show {
    display: block;
}

.action-sheet-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    color: #333;
}

.action-sheet-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.action-sheet-item:active {
    background: #f5f5f5;
}

.action-sheet-item.danger {
    color: #e74c3c;
}

.action-sheet-item-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sheet-icon {
    position: relative;
    width: 20px;
    height: 20px;
    display: inline-block;
    color: #4a5578;
}

.action-sheet-item.danger .sheet-icon {
    color: #d34c5f;
}

.sheet-icon::before,
.sheet-icon::after {
    content: '';
    position: absolute;
    box-sizing: border-box;
}

.sheet-icon-user::before {
    width: 8px;
    height: 8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    top: 1px;
    left: 6px;
}

.sheet-icon-user::after {
    width: 14px;
    height: 8px;
    border: 2px solid currentColor;
    border-top-left-radius: 9px;
    border-top-right-radius: 9px;
    border-bottom: 0;
    left: 3px;
    bottom: 2px;
}

.sheet-icon-bell::before {
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-bottom: 0;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    left: 4px;
    top: 3px;
}

.sheet-icon-bell::after {
    width: 12px;
    height: 2px;
    background: currentColor;
    left: 4px;
    bottom: 4px;
    box-shadow: 4px 4px 0 -1px currentColor;
    border-radius: 2px;
}

.sheet-icon-logout::before {
    width: 9px;
    height: 12px;
    border: 2px solid currentColor;
    border-right: 0;
    border-radius: 4px 0 0 4px;
    left: 2px;
    top: 4px;
}

.sheet-icon-logout::after {
    width: 9px;
    height: 9px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
    right: 2px;
    top: 5px;
    box-shadow: -5px 5px 0 -3px currentColor;
}

.action-sheet-item-label {
    font-size: 16px;
}

.invite-link-action-item {
    gap: 0;
    justify-content: flex-start;
}


.action-sheet-cancel {
    padding: 16px;
    text-align: center;
    color: #666;
    cursor: pointer;
    font-weight: 500;
    border-top: 1px solid #f0f0f0;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}

.modal .modal-content {
    background: white;
    padding: 24px;
    border-radius: 24px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal .modal-content-center {
    text-align: center;
}

.modal .modal-content h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
}

.modal .modal-content input,
.modal .modal-content textarea {
    width: 100%;
    padding: 14px;
    margin: 10px 0;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
}

.modal .modal-content button {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.modal .modal-content button.secondary {
    background: #e0e0e0;
    color: #333;
}

.invite-link {
    background: #f0f0f0;
    padding: 12px;
    border-radius: 12px;
    font-size: 12px;
    word-break: break-all;
    margin: 12px 0;
}

.member-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 15px 0;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    margin-right: 12px;
    background-size: cover;
    background-position: center;
}

.member-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.remove-member {
    color: #e74c3c;
    cursor: pointer;
    font-size: 12px;
    padding: 6px 12px;
    background: #fee;
    border-radius: 20px;
}

.admin-badge {
    background: #ffd700;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
}

.member-item-actions {
    display: flex;
    gap: 8px;
}

.make-admin-btn {
    background: #f0f0f0;
    border: none;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
    color: #667eea;
}

.remove-admin-btn {
    background: #f0f0f0;
    border: none;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
    color: #e74c3c;
}

.space-edit-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    margin: 10px 0;
}

.space-edit-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    margin: 10px 0;
    resize: vertical;
}

/* Стили для профиля */
.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 20px;
    display: block;
}

.profile-avatar-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 48px;
    color: white;
}

.avatar-upload-btn {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 20px;
}

.avatar-upload-btn label {
    background: #f0f0f0;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}

 .gender-select {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 12px 0 16px;
}

.gender-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid rgba(103, 116, 201, 0.18);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247,248,255,0.96)),
        linear-gradient(135deg, rgba(102,126,234,0.10), rgba(198,104,255,0.10));
    box-shadow: 0 10px 24px rgba(103, 116, 201, 0.08);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.gender-option:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(103, 116, 201, 0.12);
}

.gender-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.gender-option-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gender-option-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gender-option-icon-male {
    color: #4d7dff;
    background: linear-gradient(135deg, rgba(116, 173, 255, 0.18), rgba(76, 117, 255, 0.22));
}

.gender-option-icon-female {
    color: #cf63d8;
    background: linear-gradient(135deg, rgba(255, 155, 214, 0.22), rgba(208, 99, 216, 0.20));
}

.gender-option-text {
    font-size: 14px;
    font-weight: 600;
    color: #3b3f5c;
    line-height: 1;
}

.gender-option input:checked + .gender-option-icon {
    box-shadow: 0 0 0 5px rgba(255,255,255,0.95), 0 0 0 7px rgba(118,75,162,0.16);
}

.gender-option input:checked ~ .gender-option-text {
    color: #2b2452;
}

.gender-option:has(input:checked) {
    border-color: rgba(118,75,162,0.38);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(250,246,255,0.98)),
        linear-gradient(135deg, rgba(102,126,234,0.16), rgba(198,104,255,0.20));
    box-shadow: 0 18px 34px rgba(118,75,162,0.16);
}

@media (max-width: 420px) {
    .gender-select:not(.gender-select-inline) {
        grid-template-columns: 1fr;
    }
}


.profile-info {
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 12px;
}

.profile-field {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.profile-field:last-child {
    border-bottom: none;
}

.profile-label {
    color: #666;
    font-weight: 500;
}

.profile-value {
    color: #333;
}

.edit-profile-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 15px;
    width: 100%;
}

/* Стили для модального окна профиля пользователя */
.user-profile-modal {
    display: none;
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}

.user-profile-modal .modal-content {
    background: white;
    padding: 30px;
    border-radius: 28px;
    width: 85%;
    max-width: 320px;
    text-align: center;
    animation: slideUp 0.3s ease;
}

.user-profile-modal .user-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 16px;
    display: block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.user-profile-modal .user-avatar-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 56px;
    color: white;
}

.user-profile-modal .user-name-large {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.user-profile-modal .user-gender {
    font-size: 16px;
    color: #666;
    margin-bottom: 24px;
    padding: 8px 16px;
    background: #f5f5f5;
    border-radius: 20px;
    display: inline-block;
}

.user-profile-modal .close-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 16px;
}

.user-profile-modal .close-btn:active {
    transform: scale(0.98);
}



.profile-modal-card {
    text-align: center;
}

.profile-avatar-shell {
    position: relative;
    width: 150px;
    margin: 0 auto 14px;
}

.profile-avatar-large,
.profile-avatar-placeholder {
    width: 150px;
    height: 150px;
    margin: 0 auto;
}

.profile-avatar-action {
    cursor: pointer;
}

.profile-avatar-likes {
    position: absolute;
    top: 8px;
    right: -6px;
    min-width: 56px;
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.94);
    box-shadow: 0 10px 24px rgba(33,40,80,0.14);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #3b3f5c;
}

.profile-avatar-likes::before {
    content: '❤';
    font-size: 12px;
    color: #d34c5f;
}


.eyebrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 12px;
    background: var(--surface-2, #f4f7ff);
    color: var(--primary-1, #4b5680);
    font-size: 12px;
    font-weight: 800;
}

.profile-username-copy {
    margin: 0 auto 16px;
    border: none;
    cursor: pointer;
}

.profile-username-copy::after {
    content: none;
}

.profile-main-name {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 20px;
    font-weight: 700;
    color: #2e3350;
}

.profile-inline-gender {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.profile-inline-gender svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.profile-inline-gender.male { color: #4d7dff; }
.profile-inline-gender.female { color: #cf63d8; }

.profile-info.profile-info-compact {
    margin-top: 0;
    text-align: left;
    padding: 14px 16px;
}

.profile-info-compact .profile-field {
    align-items: flex-start;
    gap: 12px;
}

.profile-info-compact .profile-label {
    min-width: 94px;
}

.profile-info-compact .profile-value {
    text-align: right;
    flex: 1;
    word-break: break-word;
}

.profile-edit-btn {
    margin-top: 14px;
}

.profile-help-note {
    margin: -2px 0 12px;
    font-size: 12px;
    line-height: 1.45;
    color: #7a829b;
}

.profile-inline-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 14px;
    font-size: 13px;
    color: #4d5573;
}

.profile-inline-toggle input {
    width: 18px !important;
    height: 18px;
    margin: 0 !important;
}

.profile-edit-grid {
    display: grid;
    gap: 14px;
    margin: 8px 0 14px;
}

.profile-field-card {
    padding: 14px;
    border: 1px solid #eceff7;
    border-radius: 18px;
    background: #fafbff;
}

.profile-field-card-label {
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #4d5573;
}

.gender-select-inline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.profile-field-card-gender .gender-option {
    min-height: 48px;
    padding: 10px 12px;
}

.profile-birth-row {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(130px, 0.95fr);
    gap: 10px;
    align-items: stretch;
}

.profile-birth-date-selects {
    display: grid;
    grid-template-columns: 0.85fr 1fr 1.15fr;
    gap: 8px;
}

.profile-birth-row select {
    width: 100%;
    min-width: 0;
    padding: 14px;
    margin: 0;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    background: white;
}

.zeer-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(14px);
    background: rgba(31, 36, 58, 0.96);
    color: white;
    padding: 12px 16px;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(17,22,41,0.28);
    font-size: 13px;
    z-index: 1300;
    opacity: 0;
    transition: opacity .18s ease, transform .18s ease;
}

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

@media (max-width: 480px) {
    .profile-avatar-shell { width: 132px; }
    .profile-avatar-large,
    .profile-avatar-placeholder { width: 132px; height: 132px; }
    .profile-info-compact .profile-label { min-width: 78px; }
    .profile-field-card { padding: 12px; border-radius: 16px; }
    .gender-select-inline { gap: 8px; }
    .profile-field-card-gender .gender-option { min-height: 44px; padding: 10px; gap: 8px; }
    .profile-field-card-gender .gender-option-text { font-size: 13px; }
    .profile-birth-row { grid-template-columns: minmax(0, 1.5fr) minmax(112px, 0.9fr); gap: 8px; }
    .profile-birth-date-selects { gap: 6px; }
    .profile-birth-row select { padding: 12px 10px; font-size: 14px; }
}
/* Анимации */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.message {
    animation: slideIn 0.3s ease;
}

/* Стили для выделения сообщения при долгом нажатии */
.message {
    transition: background 0.2s ease;
}

.message:active {
    background: rgba(102, 126, 234, 0.1);
}

/* Стили для Action Sheet сообщения */
#messageActionSheet .action-sheet-item.danger {
    color: #e74c3c;
}

/* Стили для скроллбара */
.messages-area::-webkit-scrollbar {
    width: 4px;
}

.messages-area::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.messages-area::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========== МОБИЛЬНАЯ АДАПТАЦИЯ ========== */
@media (max-width: 768px) {
    html, body {
        height: 100%;
        overflow: hidden;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
    }

    body {
        padding: 0;
    }

    .container {
        height: 100%;
        position: relative;
        overflow: hidden;
    }

    .chat-container {
        height: 100%;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .top-bar {
        padding: 10px 12px;
        padding-top: max(10px, env(safe-area-inset-top));
        min-height: 56px;
    }

    .logo {
        font-size: 18px;
    }

    .logo span {
        font-size: 20px;
    }

    .user-profile {
        padding: 5px 8px;
        gap: 6px;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .user-name {
        font-size: 13px;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .space-selector-row {
        padding: 6px 12px;
        gap: 8px;
    }

    .current-space {
        padding: 10px 14px;
    }

    .space-name {
        font-size: 14px;
    }

    .space-icon {
        font-size: 18px;
    }

    .space-count {
        font-size: 11px;
    }

    .dropdown-icon {
        font-size: 16px;
    }

    .space-settings-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
        border-radius: 10px;
    }

    .messages-area {
        padding: 12px;
        gap: 10px;
    }

    .message-content {
        max-width: 85%;
        padding: 8px 12px;
    }

    .message-header {
        font-size: 10px;
    }

    .message-avatar {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }

    .message-text {
        font-size: 13px;
    }

    .message-photo {
        max-width: 150px;
        max-height: 150px;
    }

    .message-time {
        font-size: 8px;
    }

    .reply-preview {
        padding: 4px 8px;
        font-size: 10px;
    }

    .reply-header {
        font-size: 9px;
    }

    .reply-text {
        font-size: 9px;
    }

    .reply-preview-container {
        padding: 6px 10px;
    }

    .reply-preview-text {
        font-size: 11px;
    }

    /* Область ввода - мобильная версия */
    .input-area {
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .message-input-wrapper {
        margin-bottom: 8px;
    }

    .message-input-wrapper textarea {
        padding: 12px 16px;
        font-size: 16px;
        min-height: 44px;
        border-radius: 12px;
    }

    .action-buttons {
        gap: 10px;
        margin-top: 8px;
    }

    .emoji-toggle-btn {
        width: 48px;
        min-width: 48px;
        min-height: 48px;
        border-radius: 14px;
    }

    .emoji-picker-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .photo-label {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 48px;
        border-radius: 14px;
    }

    .send-btn {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 48px;
        border-radius: 14px;
    }

    .modal .modal-content {
        padding: 20px;
        width: 95%;
    }

    .login-card {
        padding: 30px 20px;
        margin: 20px;
    }

    .login-card h2 {
        font-size: 24px;
    }

    .login-card input {
        padding: 12px;
        font-size: 15px;
    }

    .user-profile-modal .modal-content {
        padding: 24px;
        width: 90%;
    }

    .user-profile-modal .user-avatar-large,
    .user-profile-modal .user-avatar-placeholder {
        width: 100px;
        height: 100px;
        font-size: 48px;
    }

    .user-profile-modal .user-name-large {
        font-size: 20px;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .top-bar {
        padding: 6px 10px;
        padding-top: max(6px, env(safe-area-inset-top));
        min-height: 48px;
    }

    .logo {
        font-size: 16px;
    }

    .logo span {
        font-size: 18px;
    }

    .user-profile {
        padding: 3px 8px;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .user-name {
        font-size: 12px;
        max-width: 80px;
    }

    .space-selector-row {
        padding: 4px 10px;
        gap: 6px;
    }

    .current-space {
        padding: 8px 12px;
    }

    .space-name {
        font-size: 13px;
    }

    .space-icon {
        font-size: 16px;
    }

    .dropdown-icon {
        font-size: 14px;
    }

    .space-settings-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
        border-radius: 8px;
    }

    .messages-area {
        padding: 8px;
        gap: 8px;
    }

    .message-content {
        padding: 6px 10px;
    }

    .message-text {
        font-size: 12px;
    }

    .input-area {
        padding: 8px 10px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .message-input-wrapper textarea {
        padding: 10px 14px;
        font-size: 15px;
        min-height: 40px;
        border-radius: 22px;
    }

    .action-buttons {
        gap: 8px;
    }

    .emoji-toggle-btn {
        width: 44px;
        min-width: 44px;
        min-height: 44px;
        border-radius: 12px;
        font-size: 20px;
    }

    .emoji-picker-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .photo-label {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 44px;
        border-radius: 12px;
    }

    .send-btn {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 44px;
        border-radius: 12px;
    }

    .user-profile-modal .modal-content {
        padding: 20px;
    }

    .user-profile-modal .user-avatar-large,
    .user-profile-modal .user-avatar-placeholder {
        width: 80px;
        height: 80px;
        font-size: 40px;
    }

    .user-profile-modal .user-name-large {
        font-size: 18px;
    }
}

/* Для устройств с вырезом (notch) */
@supports (padding: max(0px)) {
    .top-bar {
        padding-top: max(10px, env(safe-area-inset-top));
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    @media (max-width: 480px) {
        .top-bar {
            padding-top: max(6px, env(safe-area-inset-top));
        }
    }

    .space-selector-row {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    @media (max-width: 480px) {
        .space-selector-row {
            padding-left: max(10px, env(safe-area-inset-left));
            padding-right: max(10px, env(safe-area-inset-right));
        }
    }

    .messages-area {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    @media (max-width: 480px) {
        .messages-area {
            padding-left: max(8px, env(safe-area-inset-left));
            padding-right: max(8px, env(safe-area-inset-right));
        }
    }

    .input-area {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    @media (max-width: 480px) {
        .input-area {
            padding-bottom: max(8px, env(safe-area-inset-bottom));
            padding-left: max(10px, env(safe-area-inset-left));
            padding-right: max(10px, env(safe-area-inset-right));
        }
    }
}

/* Фикс для Firefox на мобильных */
@-moz-document url-prefix() {
    .messages-area, .spaces-dropdown, .member-list {
        scrollbar-width: thin;
    }

    .current-space:active {
        background: #e8e9ea;
    }

    .space-option:active {
        background: #f5f5f5;
    }

    .action-sheet-item:active {
        background: #f5f5f5;
    }

    .photo-label:active {
        background: #e0e0e0;
        transform: scale(0.98);
    }

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

/* Стили для ответов - усилены для мобильных */
.reply-preview {
    background: rgba(0, 0, 0, 0.08);
    border-left: 3px solid #667eea;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 10px;
    font-size: 12px;
    word-break: break-word;
}

.user2 .reply-preview {
    background: rgba(255, 255, 255, 0.25);
    border-left-color: rgba(255, 255, 255, 0.8);
}

.reply-header {
    font-size: 11px;
    opacity: 0.8;
    margin-bottom: 4px;
    font-weight: 500;
}

.reply-text {
    font-size: 11px;
    opacity: 0.9;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.4;
}

/* Блок предпросмотра ответа в области ввода */
.reply-preview-container {
    background: #f5f5f5;
    border-radius: 12px;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-left: 4px solid #667eea;
}

.reply-preview-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.reply-preview-text {
    flex: 1;
    font-size: 13px;
    color: #555;
    word-break: break-word;
    line-height: 1.4;
}

.reply-preview-text strong {
    color: #667eea;
    font-weight: 600;
}

.cancel-reply-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    padding: 0 6px;
    transition: color 0.2s;
    flex-shrink: 0;
}

.cancel-reply-btn:hover,
.cancel-reply-btn:active {
    color: #e74c3c;
}

/* Стили для выделения сообщения при долгом нажатии */
.message {
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
}

.message:active {
    background: rgba(102, 126, 234, 0.1);
}

/* Мобильная адаптация для ответов */
@media (max-width: 768px) {
    .reply-preview {
        padding: 6px 10px;
        font-size: 11px;
    }

    .reply-header {
        font-size: 10px;
    }

    .reply-text {
        font-size: 10px;
    }

    .reply-preview-container {
        padding: 8px 10px;
        margin-bottom: 8px;
    }

    .reply-preview-text {
        font-size: 12px;
    }

    .cancel-reply-btn {
        font-size: 18px;
        padding: 0 4px;
    }
}

@media (max-width: 480px) {
    .reply-preview {
        padding: 5px 8px;
        font-size: 10px;
    }

    .reply-header {
        font-size: 9px;
    }

    .reply-text {
        font-size: 9px;
    }

    .reply-preview-container {
        padding: 6px 8px;
    }

    .reply-preview-text {
        font-size: 11px;
    }
}

/* Стили для полноэкранного просмотра аватара */
.avatar-fullscreen-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.avatar-fullscreen-modal.show {
    display: flex;
}

.avatar-fullscreen-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    text-align: center;
}

.avatar-fullscreen-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.avatar-fullscreen-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    z-index: 2001;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.avatar-fullscreen-close:hover {
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .avatar-fullscreen-close {
        top: 20px;
        right: 20px;
        background: rgba(0, 0, 0, 0.7);
        font-size: 30px;
        width: 40px;
        height: 40px;
    }

    .avatar-fullscreen-content img {
        max-height: 85vh;
    }
}

/* Уведомление об обновлении PWA */
.update-notification {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    animation: slideUp 0.3s ease;
}

.update-notification button {
    background: white;
    color: #667eea;
    border: none;
    padding: 8px 20px;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 15px;
    font-size: 14px;
    transition: transform 0.2s;
}

.update-notification button:active {
    transform: scale(0.95);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .update-notification {
        left: 10px;
        right: 10px;
        border-radius: 15px;
        padding: 10px 15px;
        font-size: 12px;
    }

    .update-notification button {
        padding: 6px 15px;
        font-size: 12px;
    }
}
/* ===== Entry flow / landing / versions ===== */
.auth-screen {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.screen-version {
    margin-top: 14px;
    text-align: center;
    font-size: 12px;
    color: #8a8f9c;
}

.landing-screen {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.landing-card {
    width: 100%;
    max-width: 520px;
    background: rgba(255,255,255,0.96);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(67, 79, 136, 0.15);
    padding: 28px 22px 22px;
}

.landing-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.landing-logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
}

.landing-title {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
}

.landing-subtitle {
    color: #666;
    margin-top: 4px;
}

.landing-content h1 {
    font-size: 26px;
    line-height: 1.2;
    margin: 0 0 12px;
    color: #20253a;
}

.landing-content p {
    margin: 0;
    color: #50566b;
    line-height: 1.55;
}

.landing-features {
    display: grid;
    gap: 10px;
    margin: 20px 0 24px;
}

.landing-feature {
    background: #f5f7ff;
    border: 1px solid #e7ebff;
    border-radius: 16px;
    padding: 13px 14px;
    color: #2e3551;
}

.landing-actions {
    display: grid;
    gap: 12px;
}

.primary-action-btn,
.secondary-action-btn {
    border: none;
    border-radius: 16px;
    padding: 15px 18px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.primary-action-btn {
    color: #fff;
    background: linear-gradient(135deg, #0a38b8 0%, #b119f3 100%);
}

.secondary-action-btn {
    background: #eef1f8;
    color: #2f3650;
}

.install-hint {
    min-height: 20px;
    font-size: 13px;
    text-align: center;
    color: #6a7288;
}

.landing-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    justify-content: center;
    margin-top: 24px;
}

.landing-links a {
    color: #667eea;
    text-decoration: none;
    font-size: 13px;
}

/* ===== Chat list / chat view ===== */
.chat-list-screen,
.chat-view-screen {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-list-header {
    padding: 18px 16px 10px;
}

.chat-list-title {
    font-size: 24px;
    font-weight: 700;
    color: #20253a;
}

.chat-list-subtitle {
    margin-top: 4px;
    font-size: 14px;
    color: #7a8092;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 16px;
}

.chat-list-item {
    width: 100%;
    border: 1px solid #e7eaf4;
    background: #fff;
    border-radius: 18px;
    padding: 14px 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    text-align: left;
}

.chat-list-item:active {
    transform: scale(0.995);
}

.chat-list-item-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(10,56,184,0.12) 0%, rgba(177,25,243,0.12) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.chat-list-item-body {
    min-width: 0;
    flex: 1;
}

.chat-list-item-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2437;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-list-item-meta {
    margin-top: 4px;
    font-size: 13px;
    color: #7b8192;
}

.chat-list-footer {
    padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid #edf0f7;
    background: #fff;
}

.create-chat-btn {
    width: 100%;
    border: none;
    border-radius: 16px;
    padding: 15px 18px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #0a38b8 0%, #b119f3 100%);
    cursor: pointer;
}

.chat-view-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #edf0f7;
    background: #fff;
}

.back-to-list-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: #eff2f8;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #2f3650;
    flex-shrink: 0;
}

.chat-view-title-wrap {
    min-width: 0;
    flex: 1;
}

.chat-view-title {
    font-size: 17px;
    font-weight: 700;
    color: #1f2437;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-view-meta {
    margin-top: 2px;
    font-size: 12px;
    color: #7b8192;
}

.empty-chat-list {
    padding: 24px 16px;
    text-align: center;
    color: #7b8192;
}

@media (max-width: 768px) {
    .landing-card {
        border-radius: 22px;
        padding: 22px 18px 18px;
    }

    .landing-content h1 {
        font-size: 22px;
    }

    .chat-list-title {
        font-size: 22px;
    }
}


/* ===== Zeer 2.3.2 full overrides ===== */
:root {
    --bg-main: #f5f7fb;
    --bg-panel: #ffffff;
    --bg-soft: #eef2f8;
    --text-main: #20253a;
    --text-muted: #697082;
    --border-soft: #dfe5f0;
    --bubble-self-start: #667eea;
    --bubble-self-end: #764ba2;
    --bubble-other: #ffffff;
}

:root[data-theme="dark"] {
    --bg-main: #0f1524;
    --bg-panel: #161d2f;
    --bg-soft: #1e2940;
    --text-main: #edf1fb;
    --text-muted: #9aa5bd;
    --border-soft: #2a3550;
    --bubble-self-start: #5e72eb;
    --bubble-self-end: #7b4db8;
    --bubble-other: #1b2336;
}

body, .chat-container, .chat-list-screen, .chat-view-screen, .messages-area, .input-area, .top-bar, .chat-view-header, .chat-list-header, .chat-list, .chat-list-item, .modal .modal-content, .action-sheet {
    background-color: var(--bg-main);
    color: var(--text-main);
}

.top-bar, .chat-view-header, .input-area, .modal .modal-content, .chat-list-item, .action-sheet {
    background: var(--bg-panel) !important;
    color: var(--text-main);
    border-color: var(--border-soft) !important;
}

.messages-area {
    background-color: var(--bg-main) !important;
}

.message {
    align-items: flex-start;
    gap: 10px;
    width: 100%;
}

.message.user2 {
    flex-direction: row-reverse;
}

.message-avatar-outer {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(34,42,68,.12);
}

.message-content {
    max-width: min(78%, 720px);
    padding: 10px 14px 8px;
    border-radius: 22px;
    box-shadow: 0 8px 24px rgba(27,39,73,.08);
}

.user1 .message-content {
    background: var(--bubble-other) !important;
    color: var(--text-main);
    border: 1px solid var(--border-soft);
}

.user2 .message-content {
    background: linear-gradient(135deg, var(--bubble-self-start) 0%, var(--bubble-self-end) 100%) !important;
    color: #fff;
}

.message-header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    opacity: .85;
}

.message-author {
    font-weight: 700;
}

.user2 .message-header {
    justify-content: flex-end;
}

.message-text {
    font-size: 15px !important;
    line-height: 1.48;
    word-break: break-word;
}

.message-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.message-photo-wrap {
    margin-top: 8px;
}

.message-photo.message-photo-full {
    width: min(100%, 420px);
    max-width: 420px;
    max-height: 70vh;
    object-fit: cover;
    border-radius: 16px;
    display: block;
}

.message-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}

.message-time,
.message-edited {
    font-size: 10px;
    opacity: .72;
}

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

.message-reaction-pill {
    border: 1px solid rgba(255,255,255,.25);
    background: rgba(255,255,255,.18);
    color: inherit;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.user1 .message-reaction-pill {
    background: var(--bg-soft);
    border-color: var(--border-soft);
    color: var(--text-main);
}

.selected-space-avatar {
    margin-right: 10px;
}

.selected-space-avatar .space-avatar-chip,
.chat-list-item .space-avatar-chip,
.space-option .space-avatar-chip {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 700;
    background-size: cover;
    background-position: center;
}

.selected-space-avatar .space-avatar-chip {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 12px;
}

.space-option {
    display: flex;
    align-items: center;
    gap: 10px;
}

.space-option-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.space-option-top,
.chat-list-item-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.space-option-name,
.chat-list-item-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.space-option-last-message {
    margin-top: 4px;
    font-size: 12px;
    color: #7b8192;
}

.space-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.member-item.compact {
    border-bottom: 1px solid var(--border-soft);
    gap: 12px;
}

.member-meta {
    min-width: 0;
}

.member-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.member-username {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}

.member-menu-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border-soft);
    background: var(--bg-soft);
    color: var(--text-main);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.owner-badge {
    background: #ffdb78;
}

.space-extra-settings {
    display: grid;
    gap: 14px;
    margin: 14px 0 18px;
}

.space-setting-group {
    display: grid;
    gap: 8px;
}

.space-setting-label {
    font-size: 13px;
    font-weight: 700;
}

.space-setting-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.space-setting-hint,
.space-setting-status {
    font-size: 12px;
    color: var(--text-muted);
}

.photo-modal-fullscreen {
    position: fixed;
    inset: 0;
    background: rgba(7,10,18,.94);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.photo-modal-fullscreen.show {
    display: flex;
}

.photo-modal-stage {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.photo-modal-stage img {
    max-width: min(100vw - 16px, 1400px);
    max-height: min(100vh - 16px, 96vh);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 14px;
}

.photo-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,.16);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

.avatar-like-btn,
.avatar-like-info {
    margin-top: 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-soft);
    color: var(--text-main);
    border: 1px solid var(--border-soft);
}

.avatar-like-btn.liked {
    background: #ffe8ee;
}

.user-profile-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.user-meta-row {
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
}

@media (max-width: 768px) {
    .messages-area {
        padding: 12px 10px !important;
    }

    .message {
        gap: 8px;
    }

    .message-avatar-outer {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 12px;
    }

    .message-content {
        max-width: 82%;
        padding: 10px 13px 8px;
    }

    .message-text {
        font-size: 16px !important;
    }

    .message-photo.message-photo-full {
        width: min(100%, 82vw);
        max-width: 82vw;
        max-height: 58vh;
    }
}

@media (max-width: 480px) {
    .message-content {
        max-width: 84%;
    }

    .message-avatar-outer {
        width: 34px;
        height: 34px;
        min-width: 34px;
        border-radius: 50%;
    }

    .message-text {
        font-size: 16px !important;
    }

    .chat-view-header {
        gap: 8px;
    }
}

/* ===== hotfix 2.3.2 step 1 ===== */
.top-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #fff !important;
    border-bottom: none !important;
}

.top-bar .user-profile {
    background: rgba(255,255,255,0.16);
    color: #fff;
}

.chat-view-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-view-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.chat-view-title-block {
    min-width: 0;
    flex: 1;
}

.selected-space-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0;
    flex-shrink: 0;
}

.message.user1 {
    justify-content: flex-start !important;
}

.message.user2 {
    flex-direction: row-reverse;
    justify-content: flex-start !important;
}

.message.user1 .message-content,
.message.user2 .message-content {
    margin: 0;
}

.message.user1 .message-avatar-outer {
    order: 0;
}

.message.user2 .message-avatar-outer {
    order: 0;
}

.message.user1 .message-content {
    order: 1;
}

.message.user2 .message-content {
    order: 1;
}

.message-avatar-outer {
    align-self: flex-start;
}

@media (max-width: 768px) {
    .chat-view-title-wrap {
        gap: 8px;
    }

    .selected-space-avatar .space-avatar-chip {
        width: 34px;
        height: 34px;
        min-width: 34px;
        border-radius: 11px;
    }
}


/* ===== hotfix 2.3.2 step 2 ===== */
.reaction-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 19, 34, 0.42);
    backdrop-filter: blur(4px);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 10020;
    padding: 16px;
}

.reaction-picker-overlay.show {
    display: flex;
}

.reaction-picker-sheet {
    width: min(100%, 420px);
    background: var(--bg-card, #fff);
    color: var(--text-main, #1e2430);
    border-radius: 22px;
    box-shadow: 0 18px 50px rgba(17, 24, 39, 0.22);
    padding: 16px;
    border: 1px solid var(--border-soft, rgba(0,0,0,.08));
}

.reaction-picker-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
}

.reaction-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

.reaction-picker-btn {
    height: 48px;
    border-radius: 14px;
    border: 1px solid var(--border-soft, rgba(0,0,0,.08));
    background: var(--bg-soft, #f6f7fb);
    font-size: 24px;
    cursor: pointer;
}

.reaction-picker-close {
    margin-top: 12px;
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 12px;
    background: var(--bg-soft, #f6f7fb);
    color: var(--text-main, #1e2430);
    font-weight: 600;
    cursor: pointer;
}

.message-reaction-quickbar {
    display: flex;
    gap: 10px;
    padding: 14px 18px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.message-reaction-quick-btn {
    border: 1px solid var(--border-soft);
    background: var(--bg-soft);
    border-radius: 18px;
    min-width: 46px;
    height: 42px;
    font-size: 24px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}

.message-reaction-quick-btn:active {
    transform: scale(0.96);
}


.message-avatar-outer.is-self {
    cursor: default;
    pointer-events: none;
}

.message-avatar-outer.is-clickable {
    cursor: pointer;
}

.member-actions-trigger {
    border: 1px solid #d9dce5;
    background: #f5f6f8;
    color: #5f6675;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.member-actions-trigger:active {
    transform: scale(0.98);
}

.member-actions-modal-content {
    max-width: 360px;
}

.member-actions-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 12px 0 6px;
}

.member-action-btn {
    width: 100%;
    border: 1px solid #e0e4ec;
    background: #f7f8fb;
    color: #2f3640;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.member-action-btn:active {
    transform: scale(0.99);
}

.member-action-empty {
    text-align: center;
    color: #7d8595;
    padding: 8px 0 12px;
}

@media (max-width: 768px) {
    .member-actions-trigger {
        padding: 8px 10px;
        font-size: 11px;
    }
}

/* ===== Zeer 2.3.8 ===== */
.selected-space-avatar.is-clickable,
.selected-space-avatar.is-clickable .space-avatar-chip {
    cursor: pointer;
}

.invite-links-create-panel,
.invite-links-list-wrap {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.invite-link-type-buttons,
.invite-link-actions,
.invite-custom-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.invite-custom-row input {
    flex: 1;
    min-width: 180px;
}

.invite-links-list {
    display: grid;
    gap: 10px;
}

.invite-link-item {
    border: 1px solid #e8e8ef;
    border-radius: 16px;
    padding: 12px;
    background: #fafbff;
}

.invite-link-meta {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
}

.invite-link-action-btn {
    width: auto !important;
    margin-top: 0 !important;
    padding: 10px 14px !important;
}

.invite-link-delete-btn {
    color: #e74c3c !important;
}

.invite-type-btn {
    width: auto !important;
    margin-top: 0 !important;
}


/* ===== Zeer 2.3.11 ===== */
.pinned-message-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin: 0 12px 10px;
    background: rgba(255,255,255,0.88);
    border: 1px solid rgba(102,126,234,0.14);
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(30, 41, 59, 0.08);
}

.pinned-message-main {
    min-width: 0;
    flex: 1;
    cursor: pointer;
}

.pinned-message-kicker {
    font-size: 11px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 3px;
    letter-spacing: 0.02em;
}

.pinned-message-line {
    min-width: 0;
    color: #40485b;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pinned-message-unpin {
    width: auto !important;
    margin-top: 0 !important;
    padding: 8px 12px !important;
    border-radius: 999px !important;
    background: #f4f6fb !important;
    color: #55607a !important;
    font-size: 12px !important;
    border: 1px solid #dfe5f0 !important;
}

.message-pulse .message-content {
    box-shadow: 0 0 0 3px rgba(102,126,234,0.16), 0 8px 24px rgba(27,39,73,.08);
}

.space-extra-settings-v2311 {
    gap: 18px;
}

.space-visual-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.space-avatar-live-preview {
    width: 62px;
    height: 62px;
    min-width: 62px;
    border-radius: 18px;
    border: 1px solid #dfe5f0;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    background-size: cover !important;
    background-position: center !important;
    box-shadow: 0 8px 18px rgba(51,65,85,0.10);
}

.space-visual-side {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 10px;
}

.space-color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.space-color-dot {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 2px solid transparent;
    box-shadow: 0 0 0 1px rgba(31,36,55,0.08);
    cursor: pointer;
}

.space-color-dot.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px #667eea;
}

.space-inline-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.space-inline-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: #667eea;
    font-size: 13px;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
}

.space-inline-link.danger {
    color: #d05b74;
}


.profile-delete-wrap {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(120, 132, 167, 0.16);
    display: flex;
    justify-content: center;
}

.profile-delete-link {
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    line-height: 1.4;
    color: #9aa3ba;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color 0.18s ease, opacity 0.18s ease;
}

.profile-delete-link:hover {
    color: #cf6a7e;
}

.profile-delete-link:active {
    opacity: 0.75;
}

.legal-page {
    min-height: 100vh;
    padding: 32px 18px 40px;
    background: linear-gradient(180deg, #f6f8ff 0%, #eef2ff 100%);
}

.legal-shell {
    max-width: 980px;
    margin: 0 auto;
}

.legal-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(121, 135, 182, 0.12);
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(60, 72, 116, 0.12);
    padding: 28px 24px;
    backdrop-filter: blur(12px);
}

.legal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.legal-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #24304d;
}

.legal-brand-link img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.legal-brand-title {
    font-size: 18px;
    font-weight: 700;
}

.legal-brand-subtitle {
    font-size: 12px;
    color: #7f87a0;
}

.legal-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(102, 126, 234, 0.18);
    color: #5668b8;
    text-decoration: none;
    background: rgba(102, 126, 234, 0.06);
    font-size: 13px;
    font-weight: 600;
}

.legal-hero {
    margin-bottom: 24px;
}

.legal-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.08);
    color: #5d6fd0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.legal-hero h1 {
    margin: 0 0 10px;
    font-size: clamp(30px, 4.6vw, 46px);
    line-height: 1.05;
    color: #1d2740;
}

.legal-lead {
    margin: 0;
    font-size: 16px;
    line-height: 1.65;
    color: #54607f;
    max-width: 760px;
}

.legal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 0;
}

.legal-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f6f8ff;
    border: 1px solid rgba(119, 131, 173, 0.14);
    color: #62708f;
    font-size: 13px;
}

.legal-grid {
    display: grid;
    gap: 16px;
}

.legal-section {
    padding: 20px 20px 18px;
    border-radius: 22px;
    background: #fbfcff;
    border: 1px solid rgba(121, 135, 182, 0.12);
}

.legal-section h2 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #233153;
}

.legal-section p,
.legal-section li {
    margin: 0;
    font-size: 15px;
    line-height: 1.7;
    color: #55627f;
}

.legal-section p + p {
    margin-top: 12px;
}

.legal-section ul,
.legal-section ol {
    margin: 10px 0 0;
    padding-left: 22px;
}

.legal-note {
    padding: 16px 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.08), rgba(102, 126, 234, 0.03));
    border: 1px solid rgba(102, 126, 234, 0.14);
}

.legal-note p {
    color: #49567a;
}

.legal-footer {
    margin-top: 22px;
    font-size: 13px;
    line-height: 1.6;
    color: #7c86a1;
}

.legal-footer a,
.legal-section a {
    color: #5d6fd0;
    text-decoration: none;
}

@media (max-width: 640px) {
    .legal-page {
        padding: 18px 12px 28px;
    }
    .legal-card {
        border-radius: 22px;
        padding: 20px 16px;
    }
    .legal-topbar {
        align-items: flex-start;
        flex-direction: column;
    }
    .legal-section {
        padding: 18px 16px 16px;
        border-radius: 18px;
    }
}

.space-background-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.space-bg-preset {
    padding: 0;
    border: 2px solid transparent;
    border-radius: 16px;
    background: transparent;
    cursor: pointer;
    overflow: hidden;
}

.space-bg-preset.active {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
}

.space-bg-preset-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    background-size: cover;
    background-position: center;
    border-radius: 14px;
}


.space-bg-upload-tile {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #dfe5f0;
    border-radius: 16px;
    background: #ffffff;
    cursor: pointer;
    padding: 0;
    box-shadow: none;
}

.space-bg-upload-plus {
    color: #7b8497;
    font-size: 28px;
    line-height: 1;
    font-weight: 400;
}

.space-bg-upload-tile:active {
    transform: scale(0.98);
}

@media (max-width: 768px) {
    .pinned-message-bar {
        margin: 0 10px 8px;
        padding: 9px 12px;
    }

    
.profile-delete-wrap {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(120, 132, 167, 0.16);
    display: flex;
    justify-content: center;
}

.profile-delete-link {
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    line-height: 1.4;
    color: #9aa3ba;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color 0.18s ease, opacity 0.18s ease;
}

.profile-delete-link:hover {
    color: #cf6a7e;
}

.profile-delete-link:active {
    opacity: 0.75;
}

.legal-page {
    min-height: 100vh;
    padding: 32px 18px 40px;
    background: linear-gradient(180deg, #f6f8ff 0%, #eef2ff 100%);
}

.legal-shell {
    max-width: 980px;
    margin: 0 auto;
}

.legal-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(121, 135, 182, 0.12);
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(60, 72, 116, 0.12);
    padding: 28px 24px;
    backdrop-filter: blur(12px);
}

.legal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.legal-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #24304d;
}

.legal-brand-link img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.legal-brand-title {
    font-size: 18px;
    font-weight: 700;
}

.legal-brand-subtitle {
    font-size: 12px;
    color: #7f87a0;
}

.legal-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(102, 126, 234, 0.18);
    color: #5668b8;
    text-decoration: none;
    background: rgba(102, 126, 234, 0.06);
    font-size: 13px;
    font-weight: 600;
}

.legal-hero {
    margin-bottom: 24px;
}

.legal-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.08);
    color: #5d6fd0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.legal-hero h1 {
    margin: 0 0 10px;
    font-size: clamp(30px, 4.6vw, 46px);
    line-height: 1.05;
    color: #1d2740;
}

.legal-lead {
    margin: 0;
    font-size: 16px;
    line-height: 1.65;
    color: #54607f;
    max-width: 760px;
}

.legal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 0;
}

.legal-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f6f8ff;
    border: 1px solid rgba(119, 131, 173, 0.14);
    color: #62708f;
    font-size: 13px;
}

.legal-grid {
    display: grid;
    gap: 16px;
}

.legal-section {
    padding: 20px 20px 18px;
    border-radius: 22px;
    background: #fbfcff;
    border: 1px solid rgba(121, 135, 182, 0.12);
}

.legal-section h2 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #233153;
}

.legal-section p,
.legal-section li {
    margin: 0;
    font-size: 15px;
    line-height: 1.7;
    color: #55627f;
}

.legal-section p + p {
    margin-top: 12px;
}

.legal-section ul,
.legal-section ol {
    margin: 10px 0 0;
    padding-left: 22px;
}

.legal-note {
    padding: 16px 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.08), rgba(102, 126, 234, 0.03));
    border: 1px solid rgba(102, 126, 234, 0.14);
}

.legal-note p {
    color: #49567a;
}

.legal-footer {
    margin-top: 22px;
    font-size: 13px;
    line-height: 1.6;
    color: #7c86a1;
}

.legal-footer a,
.legal-section a {
    color: #5d6fd0;
    text-decoration: none;
}

@media (max-width: 640px) {
    .legal-page {
        padding: 18px 12px 28px;
    }
    .legal-card {
        border-radius: 22px;
        padding: 20px 16px;
    }
    .legal-topbar {
        align-items: flex-start;
        flex-direction: column;
    }
    .legal-section {
        padding: 18px 16px 16px;
        border-radius: 18px;
    }
}

.space-background-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.space-extra-settings-v2311,
.space-extra-settings-v2311 * {
    box-sizing: border-box;
}

.space-extra-settings-v2311 {
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

.space-setting-group {
    min-width: 0;
}

.space-compact-picker {
    position: relative;
    width: fit-content;
    max-width: 100%;
}

.space-picker-popover {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 30;
    display: none;
    width: min(260px, calc(100vw - 64px));
    max-width: calc(100vw - 64px);
    padding: 12px;
    border-radius: 16px;
    border: 1px solid #dfe5f0;
    background: #fff;
    box-shadow: 0 16px 36px rgba(17, 24, 39, 0.14);
}

.space-picker-popover.wide {
    width: min(320px, calc(100vw - 64px));
}

.space-picker-popover.open {
    display: block;
}

.space-avatar-live-preview,
.space-bg-live-trigger {
    cursor: pointer;
}

.space-bg-live-trigger {
    width: 62px;
    height: 62px;
    padding: 0;
    border-radius: 18px;
    border: 1px solid #dfe5f0;
    background: #f7f8fc;
    box-shadow: 0 8px 18px rgba(51,65,85,0.10);
    overflow: hidden;
}

.space-bg-live-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #667085;
    font-size: 13px;
    background-size: cover;
    background-position: center;
}

.space-inline-actions.compact {
    margin-top: 10px;
    justify-content: space-between;
    gap: 10px;
}


.profile-delete-wrap {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(120, 132, 167, 0.16);
    display: flex;
    justify-content: center;
}

.profile-delete-link {
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    line-height: 1.4;
    color: #9aa3ba;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color 0.18s ease, opacity 0.18s ease;
}

.profile-delete-link:hover {
    color: #cf6a7e;
}

.profile-delete-link:active {
    opacity: 0.75;
}

.legal-page {
    min-height: 100vh;
    padding: 32px 18px 40px;
    background: linear-gradient(180deg, #f6f8ff 0%, #eef2ff 100%);
}

.legal-shell {
    max-width: 980px;
    margin: 0 auto;
}

.legal-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(121, 135, 182, 0.12);
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(60, 72, 116, 0.12);
    padding: 28px 24px;
    backdrop-filter: blur(12px);
}

.legal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.legal-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #24304d;
}

.legal-brand-link img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.legal-brand-title {
    font-size: 18px;
    font-weight: 700;
}

.legal-brand-subtitle {
    font-size: 12px;
    color: #7f87a0;
}

.legal-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(102, 126, 234, 0.18);
    color: #5668b8;
    text-decoration: none;
    background: rgba(102, 126, 234, 0.06);
    font-size: 13px;
    font-weight: 600;
}

.legal-hero {
    margin-bottom: 24px;
}

.legal-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.08);
    color: #5d6fd0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.legal-hero h1 {
    margin: 0 0 10px;
    font-size: clamp(30px, 4.6vw, 46px);
    line-height: 1.05;
    color: #1d2740;
}

.legal-lead {
    margin: 0;
    font-size: 16px;
    line-height: 1.65;
    color: #54607f;
    max-width: 760px;
}

.legal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 0;
}

.legal-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f6f8ff;
    border: 1px solid rgba(119, 131, 173, 0.14);
    color: #62708f;
    font-size: 13px;
}

.legal-grid {
    display: grid;
    gap: 16px;
}

.legal-section {
    padding: 20px 20px 18px;
    border-radius: 22px;
    background: #fbfcff;
    border: 1px solid rgba(121, 135, 182, 0.12);
}

.legal-section h2 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #233153;
}

.legal-section p,
.legal-section li {
    margin: 0;
    font-size: 15px;
    line-height: 1.7;
    color: #55627f;
}

.legal-section p + p {
    margin-top: 12px;
}

.legal-section ul,
.legal-section ol {
    margin: 10px 0 0;
    padding-left: 22px;
}

.legal-note {
    padding: 16px 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.08), rgba(102, 126, 234, 0.03));
    border: 1px solid rgba(102, 126, 234, 0.14);
}

.legal-note p {
    color: #49567a;
}

.legal-footer {
    margin-top: 22px;
    font-size: 13px;
    line-height: 1.6;
    color: #7c86a1;
}

.legal-footer a,
.legal-section a {
    color: #5d6fd0;
    text-decoration: none;
}

@media (max-width: 640px) {
    .legal-page {
        padding: 18px 12px 28px;
    }
    .legal-card {
        border-radius: 22px;
        padding: 20px 16px;
    }
    .legal-topbar {
        align-items: flex-start;
        flex-direction: column;
    }
    .legal-section {
        padding: 18px 16px 16px;
        border-radius: 18px;
    }
}

.space-background-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 768px) {
    .space-picker-popover,
    .space-picker-popover.wide {
        width: min(320px, calc(100vw - 48px));
        max-width: calc(100vw - 48px);
    }

    
.profile-delete-wrap {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(120, 132, 167, 0.16);
    display: flex;
    justify-content: center;
}

.profile-delete-link {
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    line-height: 1.4;
    color: #9aa3ba;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color 0.18s ease, opacity 0.18s ease;
}

.profile-delete-link:hover {
    color: #cf6a7e;
}

.profile-delete-link:active {
    opacity: 0.75;
}

.legal-page {
    min-height: 100vh;
    padding: 32px 18px 40px;
    background: linear-gradient(180deg, #f6f8ff 0%, #eef2ff 100%);
}

.legal-shell {
    max-width: 980px;
    margin: 0 auto;
}

.legal-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(121, 135, 182, 0.12);
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(60, 72, 116, 0.12);
    padding: 28px 24px;
    backdrop-filter: blur(12px);
}

.legal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.legal-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #24304d;
}

.legal-brand-link img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.legal-brand-title {
    font-size: 18px;
    font-weight: 700;
}

.legal-brand-subtitle {
    font-size: 12px;
    color: #7f87a0;
}

.legal-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(102, 126, 234, 0.18);
    color: #5668b8;
    text-decoration: none;
    background: rgba(102, 126, 234, 0.06);
    font-size: 13px;
    font-weight: 600;
}

.legal-hero {
    margin-bottom: 24px;
}

.legal-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.08);
    color: #5d6fd0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.legal-hero h1 {
    margin: 0 0 10px;
    font-size: clamp(30px, 4.6vw, 46px);
    line-height: 1.05;
    color: #1d2740;
}

.legal-lead {
    margin: 0;
    font-size: 16px;
    line-height: 1.65;
    color: #54607f;
    max-width: 760px;
}

.legal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 0;
}

.legal-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f6f8ff;
    border: 1px solid rgba(119, 131, 173, 0.14);
    color: #62708f;
    font-size: 13px;
}

.legal-grid {
    display: grid;
    gap: 16px;
}

.legal-section {
    padding: 20px 20px 18px;
    border-radius: 22px;
    background: #fbfcff;
    border: 1px solid rgba(121, 135, 182, 0.12);
}

.legal-section h2 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #233153;
}

.legal-section p,
.legal-section li {
    margin: 0;
    font-size: 15px;
    line-height: 1.7;
    color: #55627f;
}

.legal-section p + p {
    margin-top: 12px;
}

.legal-section ul,
.legal-section ol {
    margin: 10px 0 0;
    padding-left: 22px;
}

.legal-note {
    padding: 16px 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.08), rgba(102, 126, 234, 0.03));
    border: 1px solid rgba(102, 126, 234, 0.14);
}

.legal-note p {
    color: #49567a;
}

.legal-footer {
    margin-top: 22px;
    font-size: 13px;
    line-height: 1.6;
    color: #7c86a1;
}

.legal-footer a,
.legal-section a {
    color: #5d6fd0;
    text-decoration: none;
}

@media (max-width: 640px) {
    .legal-page {
        padding: 18px 12px 28px;
    }
    .legal-card {
        border-radius: 22px;
        padding: 20px 16px;
    }
    .legal-topbar {
        align-items: flex-start;
        flex-direction: column;
    }
    .legal-section {
        padding: 18px 16px 16px;
        border-radius: 18px;
    }
}

.space-background-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}


.space-color-palette.square {
    display: grid;
    grid-template-columns: repeat(3, 32px);
    gap: 10px;
}

.space-color-palette.square .space-color-dot {
    width: 32px;
    height: 32px;
    border-radius: 10px;
}

.space-picker-popover {
    width: min(220px, calc(100vw - 64px));
}

.space-picker-popover.wide {
    width: min(320px, calc(100vw - 64px));
}

.space-inline-actions.compact {
    justify-content: flex-start;
}


.pending-invites-wrap {
    display: grid;
    gap: 10px;
    padding: 0 16px 14px;
}

.pending-invites-title {
    font-size: 14px;
    font-weight: 700;
    color: #3b4354;
}

.pending-invites-list {
    display: grid;
    gap: 10px;
}

.pending-invite-card {
    background: #f8f9ff;
    border: 1px solid #e2e7f5;
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 8px 18px rgba(39, 51, 89, 0.05);
}

.pending-invite-text {
    font-size: 14px;
    line-height: 1.45;
    color: #2d3445;
}

.pending-invite-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.pending-invite-btn {
    width: auto !important;
    margin-top: 0 !important;
    padding: 10px 14px !important;
    border-radius: 12px !important;
}

.pending-invite-btn.accept {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #fff !important;
}

.pending-invite-btn.decline {
    background: #eef1f6 !important;
    color: #3e4658 !important;
}


/* ===== Zeer 2.3.23 billing/paywall ===== */
.space-setting-badge,
.invite-billing-summary,
.space-plan-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.10);
    color: #5b4bb7;
    font-size: 12px;
    font-weight: 600;
    margin: 4px 0 10px;
}

.space-setting-locked {
    opacity: 0.96;
}

.paywall-modal-content {
    max-width: 420px;
}

.paywall-badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.12);
    color: #5f52c7;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
}

.paywall-subtitle {
    color: #666;
    line-height: 1.5;
    margin-bottom: 14px;
}

.paywall-features {
    margin: 0 0 12px 0;
    padding-left: 20px;
    color: #444;
}

.paywall-features li {
    margin-bottom: 8px;
    line-height: 1.4;
}

.paywall-feature-label {
    font-size: 12px;
    color: #777;
    margin-bottom: 10px;
}

.space-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 0 7px;
    margin-left: 8px;
}

.space-option-main,
.chat-list-item-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.space-option-meta,
.chat-list-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.chat-list-item-last {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.invite-link-item {
    background: #f7f7fb;
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 10px;
}

.invite-link-meta {
    font-size: 12px;
    color: #666;
    margin: 8px 0;
}

.invite-link-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.invite-link-action-btn {
    width: auto !important;
    flex: 1;
    min-width: 120px;
}

@media (max-width: 480px) {
    .invite-link-actions {
        flex-direction: column;
    }
}


/* ===== Zeer 2.3.26 concept skin ===== */
:root {
    --z-bg: #f3f5fb;
    --z-bg2: #fbfcff;
    --z-surface: rgba(255,255,255,0.82);
    --z-surface-solid: #ffffff;
    --z-surface-2: #f4f7ff;
    --z-surface-3: #eef2ff;
    --z-text: #161a2d;
    --z-muted: #6f7895;
    --z-line: rgba(18,28,60,.09);
    --z-line-strong: rgba(18,28,60,.15);
    --z-shadow: 0 30px 90px rgba(33,40,80,.16);
    --z-card-shadow: 0 18px 46px rgba(33,40,80,.10);
    --z-primary-1: #0d3dbb;
    --z-primary-2: #7c4dff;
    --z-primary-3: #c668ff;
    --z-grad: linear-gradient(135deg,#0d3dbb 0%,#7c4dff 52%,#c668ff 100%);
    --z-grad-soft: linear-gradient(135deg,rgba(13,61,187,.12),rgba(198,104,255,.10));
    --z-hero:
        radial-gradient(circle at 0% 0%, rgba(13,61,187,.15), transparent 28%),
        radial-gradient(circle at 100% 0%, rgba(198,104,255,.16), transparent 30%),
        linear-gradient(180deg, rgba(255,255,255,.96), rgba(245,247,255,.94));
    --z-nav-bg: rgba(255,255,255,.78);
    --z-overlay: rgba(7,10,19,.52);
    --z-danger: #d64d68;
    --z-success: #12a36b;
    --z-warning: #f39a40;
}
html {
    background:
        radial-gradient(circle at 0% 0%, rgba(13,61,187,.08), transparent 18%),
        radial-gradient(circle at 100% 0%, rgba(198,104,255,.08), transparent 18%),
        var(--z-bg);
}
body {
    color: var(--z-text);
    background:
        radial-gradient(circle at 0% 0%, rgba(13,61,187,.08), transparent 18%),
        radial-gradient(circle at 100% 0%, rgba(198,104,255,.08), transparent 18%),
        var(--z-bg);
}
.container,
.chat-list-footer,
.chat-view-header,
.space-selector-row,
.input-area,
.top-bar,
.login-card,
.landing-card,
.chat-list-item,
.current-space,
.spaces-dropdown,
.modal .modal-content,
.user-profile-modal .modal-content,
.action-sheet,
.pending-invite-card,
.invite-link-item,
.notification-settings-card,
.member-item,
.profile-info {
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}
.container {
    background: var(--z-hero);
}
.top-bar {
    background: transparent;
    color: var(--z-text);
    border-bottom: 1px solid var(--z-line);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}
.logo,
.user-name,
.chat-view-title,
.chat-list-title,
.space-name,
.space-option-name,
.profile-value,
.member-info span,
.modal .modal-content h3 {
    color: var(--z-text);
}
.logo span {
    filter: saturate(1.1);
}
.user-profile,
.space-settings-btn,
.back-to-list-btn,
.emoji-toggle-btn,
.photo-label,
.current-space,
.chat-view-header,
.chat-list-footer,
.reply-preview-container,
.space-bg-live-trigger,
.invite-link-item,
.pending-invite-card,
.member-item,
.profile-info,
.space-picker-popover,
.space-picker-popover.wide,
.space-color-dot,
#updateNotification .update-notification {
    background: var(--z-nav-bg) !important;
    border: 1px solid var(--z-line) !important;
    box-shadow: var(--z-card-shadow) !important;
}
.chat-list-item,
.current-space,
.spaces-dropdown,
.modal .modal-content,
.user-profile-modal .modal-content,
.action-sheet,
.login-card,
.landing-card,
.pending-invite-card,
.invite-link-item,
.member-item,
.profile-info {
    background: var(--z-surface) !important;
    border: 1px solid var(--z-line);
    box-shadow: var(--z-shadow);
}
.login-container,
.auth-screen,
.landing-screen {
    background:
        radial-gradient(circle at 0% 0%, rgba(13,61,187,.15), transparent 28%),
        radial-gradient(circle at 100% 0%, rgba(198,104,255,.16), transparent 30%),
        linear-gradient(180deg, rgba(255,255,255,.96), rgba(245,247,255,.94));
}
.login-card,
.landing-card {
    border-radius: 30px;
}
.login-card input,
.modal .modal-content input,
.modal .modal-content textarea,
.space-edit-input,
.space-edit-textarea,
.message-input-wrapper textarea,
.invite-custom-row input,
#inviteUsernameSpace,
#inviteMaxUsesSpace,
#inviteExpiresAtSpace {
    border: 1px solid var(--z-line-strong) !important;
    background: rgba(255,255,255,.78) !important;
    color: var(--z-text) !important;
    border-radius: 18px !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.45);
}
.login-card input:focus,
.modal .modal-content input:focus,
.modal .modal-content textarea:focus,
.space-edit-input:focus,
.space-edit-textarea:focus,
.message-input-wrapper textarea:focus,
.invite-custom-row input:focus,
#inviteUsernameSpace:focus,
#inviteMaxUsesSpace:focus,
#inviteExpiresAtSpace:focus {
    outline: none;
    border-color: rgba(124,77,255,.45) !important;
    box-shadow: 0 0 0 4px rgba(124,77,255,.10), inset 0 1px 0 rgba(255,255,255,.5) !important;
}
.login-card button,
.modal .modal-content button:not(.secondary),
.send-btn,
.create-chat-btn,
.edit-profile-btn,
#paywallPrimaryBtn,
.pending-invite-btn.accept,
.invite-link-action-btn:not(.secondary) {
    background: var(--z-grad) !important;
    color: #fff !important;
    border: none;
    box-shadow: 0 16px 32px rgba(88,63,255,.24);
}
.modal .modal-content button.secondary,
.pending-invite-btn.decline,
.invite-link-action-btn.secondary,
.invite-type-btn.secondary,
#paywallSecondaryBtn,
.action-sheet-cancel,
.secondary-action-btn {
    background: rgba(255,255,255,.78) !important;
    color: var(--z-text) !important;
    border: 1px solid var(--z-line) !important;
    box-shadow: var(--z-card-shadow) !important;
}
.chat-list-item,
.current-space,
.pending-invite-card,
.invite-link-item,
.member-item {
    border-radius: 24px !important;
}
.chat-list-item-icon,
.selected-space-avatar,
.space-avatar-live-preview,
.space-icon {
    background: var(--z-grad-soft) !important;
    color: var(--z-primary-1);
}
.chat-view-header,
.chat-list-footer,
.input-area,
.space-selector-row {
    background: rgba(255,255,255,.58) !important;
    border-color: var(--z-line) !important;
}
.chat-container,
.chat-view-screen,
.chat-list-screen,
.messages-area {
    background: transparent;
}
.messages-area {
    background: transparent !important;
    padding-bottom: 18px;
}
.message-content {
    border-radius: 22px !important;
    box-shadow: var(--z-card-shadow);
}
.user1 .message-content {
    background: rgba(255,255,255,.90) !important;
    border: 1px solid var(--z-line) !important;
}
.user2 .message-content {
    background: var(--z-grad) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 16px 30px rgba(78,76,241,.26);
}
.reply-preview,
.reply-preview-container {
    border-left-color: var(--z-primary-2) !important;
}
.action-sheet-overlay,
.modal,
.user-profile-modal,
.zeer-dialog-overlay {
    background: var(--z-overlay) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.action-sheet {
    border-radius: 30px 30px 0 0 !important;
    overflow: hidden;
}
.action-sheet-header {
    font-size: 14px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--z-muted);
    border-bottom-color: var(--z-line);
}
.action-sheet-item,
.action-sheet-cancel {
    border-bottom-color: var(--z-line) !important;
}
.action-sheet-item:active,
.action-sheet-cancel:active,
.chat-list-item:active,
.space-option:active,
.current-space:active,
.user-profile:active,
.space-settings-btn:active,
.back-to-list-btn:active,
.emoji-toggle-btn:active,
.photo-label:active,
.send-btn:active,
.login-card button:active,
.modal .modal-content button:active {
    transform: scale(.985);
}
.modal .modal-content,
.user-profile-modal .modal-content {
    border-radius: 30px !important;
    padding: 26px !important;
}
.paywall-badge,
.space-setting-badge,
.invite-billing-summary,
.space-plan-chip,
.admin-badge,
.badge-like {
    background: var(--z-grad-soft) !important;
    color: var(--z-primary-1) !important;
    border: 1px solid rgba(124,77,255,.14);
}
.space-unread-badge {
    background: var(--z-grad) !important;
}
#updateNotification {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    left: 14px;
    right: 14px;
    z-index: 2100;
}
#updateNotification .update-notification {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-radius: 22px;
    padding: 14px 16px;
}
#updateNotification button {
    border: none;
    border-radius: 14px;
    padding: 10px 14px;
    background: var(--z-grad);
    color: #fff;
    font-weight: 700;
}
.zeer-dialog-root {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 4000;
}
.zeer-dialog-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    opacity: 0;
    pointer-events: auto;
    transition: opacity .18s ease;
}
.zeer-dialog-overlay.show { opacity: 1; }
.zeer-dialog-overlay.hide { opacity: 0; }
.zeer-dialog {
    width: min(420px, calc(100vw - 24px));
    background: var(--z-surface);
    border: 1px solid var(--z-line);
    border-radius: 30px;
    box-shadow: var(--z-shadow);
    padding: 24px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}
.zeer-dialog-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--z-grad-soft);
    color: var(--z-primary-1);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
}
.zeer-dialog-title {
    margin: 0 0 10px;
    font-size: 24px;
    line-height: 1.1;
    color: var(--z-text);
}
.zeer-dialog-message {
    color: var(--z-muted);
    line-height: 1.55;
    font-size: 15px;
}
.zeer-dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}
.zeer-dialog-actions.single {
    grid-template-columns: 1fr;
}
.zeer-dialog-btn {
    border: 1px solid var(--z-line);
    border-radius: 18px;
    padding: 14px 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.zeer-dialog-btn.primary {
    background: var(--z-grad);
    color: #fff;
    border: none;
}
.zeer-dialog-btn.secondary {
    background: rgba(255,255,255,.78);
    color: var(--z-text);
}
.zeer-dialog-btn.danger {
    background: linear-gradient(135deg,#d64d68,#ff7a91);
    color: #fff;
    border: none;
}
@media (max-width: 768px) {
    .top-bar {
        min-height: 62px;
        padding-inline: 14px;
    }
    .chat-view-header,
    .chat-list-header,
    .pending-invites-wrap,
    .chat-list,
    .messages-area,
    .input-area {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }
    .modal .modal-content,
    .user-profile-modal .modal-content,
    .zeer-dialog {
        border-radius: 28px !important;
    }
}


/* ===== Exact auth button fix ===== */
.login-card button {
    border-radius: 18px;
}

.login-card button.btn-ghost,
.login-card .btn-ghost,
.login-card .auth-secondary-btn {
    background: #ffffff !important;
    color: #161a2d !important;
    border: 1px solid rgba(18,28,60,.09) !important;
    box-shadow: none !important;
    font-weight: 500 !important;
    border-radius: 18px !important;
    padding: 14px 18px !important;
}

.login-card button.btn-ghost:hover,
.login-card .btn-ghost:hover,
.login-card .auth-secondary-btn:hover {
    background: #ffffff !important;
    color: #161a2d !important;
}

.login-card button.btn-ghost:active,
.login-card .btn-ghost:active,
.login-card .auth-secondary-btn:active {
    background: #ffffff !important;
    color: #161a2d !important;
    transform: scale(0.98);
}


/* ===== Zeer 2.4.4 header fix ===== */
.top-bar .logo,
.top-bar .logo-text,
.top-bar .logo span {
    color: #fff !important;
}


/* ===== 2.4.6 hotfix: update notification + white forms ===== */
#updateNotification {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    left: 14px;
    right: 14px;
    z-index: 2100;
    pointer-events: none;
    display: flex;
    justify-content: center;
}

#updateNotification .update-notification {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    width: min(100%, 560px);
    max-width: calc(100vw - 28px);
    min-width: 0;
    padding: 16px;
    border-radius: 24px;
    overflow: hidden;
    background: #ffffff !important;
    border: 1px solid var(--z-line, rgba(98, 110, 140, .18)) !important;
    box-shadow: 0 18px 44px rgba(22, 28, 45, .18) !important;
    color: var(--z-text, #20253a) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

#updateNotification .update-notification::before {
    content: '';
    width: 4px;
    align-self: stretch;
    border-radius: 999px;
    background: var(--z-grad, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    flex-shrink: 0;
}

#updateNotification .update-notification-body {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#updateNotification .update-notification-title {
    margin: 0;
    font-size: 15px;
    line-height: 1.35;
    font-weight: 800;
    color: var(--z-text, #20253a);
    word-break: break-word;
}

#updateNotification .update-notification-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--z-muted, #697082);
    word-break: break-word;
}

#updateNotification .update-notification-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    min-width: 0;
    margin-left: auto;
}

#updateNotification .update-notification button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 16px;
    padding: 11px 16px;
    min-height: 44px;
    max-width: 100%;
    background: var(--z-grad, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    color: #fff;
    font-size: 14px;
    line-height: 1;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 12px 26px rgba(88,63,255,.24);
}

#updateNotification .update-notification button:hover {
    transform: translateY(-1px);
}

#updateNotification .update-notification button:active {
    transform: scale(.98);
}

.login-card,
.modal .modal-content,
.user-profile-modal .modal-content {
    background: #ffffff !important;
}

@media (max-width: 640px) {
    #updateNotification {
        top: calc(10px + env(safe-area-inset-top));
        left: 10px;
        right: 10px;
    }

    #updateNotification .update-notification {
        gap: 12px;
        padding: 14px;
        border-radius: 20px;
        max-width: calc(100vw - 20px);
    }

    #updateNotification .update-notification-title {
        font-size: 14px;
    }

    #updateNotification .update-notification-text {
        font-size: 12px;
    }

    #updateNotification .update-notification-actions {
        align-self: center;
    }

    #updateNotification .update-notification button {
        padding: 10px 14px;
        min-height: 42px;
        border-radius: 14px;
        font-size: 13px;
    }
}

@media (max-width: 520px) {
    #updateNotification .update-notification {
        align-items: stretch;
        flex-wrap: wrap;
        gap: 14px;
    }

    #updateNotification .update-notification-actions {
        width: 100%;
        margin-left: 0;
    }

    #updateNotification .update-notification button {
        width: 100%;
    }
}


/* ===== Zeer 2.4.8 white popup surfaces + list avatars ===== */
.modal .modal-content,
.user-profile-modal .modal-content,
.action-sheet,
.emoji-picker,
.space-picker-popover,
.space-picker-popover.wide,
.invite-links-list-wrap,
.pending-invites-wrap,
.zeer-dialog,
#updateNotification .update-notification,
.paywall-modal-content,
#promptModal .modal-content {
    background: #ffffff !important;
}

.modal .modal-content input,
.modal .modal-content textarea,
#promptModalInput,
.emoji-picker-btn,
.invite-custom-row input,
#inviteUsernameSpace,
#inviteMaxUsesSpace,
#inviteExpiresAtSpace {
    background: #ffffff !important;
}

.space-option,
.chat-list-item {
    align-items: center;
}

.chat-list-item > .space-avatar-chip,
.space-option > .space-avatar-chip {
    flex-shrink: 0;
}

.chat-list-item > .space-avatar-chip {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    margin-right: 14px;
}

.space-option > .space-avatar-chip {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    margin-right: 12px;
}

@media (max-width: 768px) {
    .chat-list-item > .space-avatar-chip {
        width: 48px;
        height: 48px;
        margin-right: 12px;
    }

    .space-option > .space-avatar-chip {
        width: 42px;
        height: 42px;
        margin-right: 10px;
    }
}


.modal .modal-content .profile-username-copy,
.modal .modal-content button.profile-username-copy,
.modal .modal-content button.eyebrow.profile-username-copy,
.modal .modal-content button:not(.secondary).profile-username-copy,
.profile-modal-card .profile-username-copy {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    max-width: 100%;
    margin: 0 auto 16px;
    padding: 8px 12px;
    border: none !important;
    border-radius: 999px;
    background: var(--surface-2, #f4f7ff) !important;
    color: var(--primary-1, #4b5680) !important;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    box-shadow: none !important;
}

.modal .modal-content button.profile-username-copy:hover,
.modal .modal-content button.eyebrow.profile-username-copy:hover,
.modal .modal-content button:not(.secondary).profile-username-copy:hover,
.profile-modal-card .profile-username-copy:hover,
.modal .modal-content button.profile-username-copy:active,
.modal .modal-content button.eyebrow.profile-username-copy:active,
.modal .modal-content button:not(.secondary).profile-username-copy:active,
.profile-modal-card .profile-username-copy:active {
    background: var(--surface-2, #f4f7ff) !important;
    color: var(--primary-1, #4b5680) !important;
    box-shadow: none !important;
    transform: none;
}

.zeer-dialog-btn:focus,
.zeer-dialog-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.16);
}


/* ===== modal scrollbar fix: no reserved gutter, balanced paddings ===== */
.modal .modal-content,
.user-profile-modal .modal-content {
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: auto;
    overscroll-behavior: contain;
}

.modal .modal-content::-webkit-scrollbar,
.user-profile-modal .modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal .modal-content::-webkit-scrollbar-track,
.user-profile-modal .modal-content::-webkit-scrollbar-track {
    background: transparent;
    margin: 14px 0;
}

.modal .modal-content::-webkit-scrollbar-thumb,
.user-profile-modal .modal-content::-webkit-scrollbar-thumb {
    background: rgba(103, 116, 201, 0.32);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.modal .modal-content::-webkit-scrollbar-thumb:hover,
.user-profile-modal .modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(103, 116, 201, 0.5);
    border: 2px solid transparent;
    background-clip: padding-box;
}

@supports not selector(::-webkit-scrollbar) {
    .modal .modal-content,
    .user-profile-modal .modal-content {
        scrollbar-width: thin;
        scrollbar-color: rgba(103, 116, 201, 0.4) transparent;
    }
}

.profile-email-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 0 0;
}

.profile-email-row input[type="email"] {
    flex: 1;
    margin: 0 !important;
}

.profile-email-row .profile-inline-toggle {
    flex-shrink: 0;
    margin: 0;
    min-height: 52px;
    padding: 0 14px;
    border-radius: 16px;
    border: 1px solid rgba(103, 116, 201, 0.14);
    background: rgba(255,255,255,0.72);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.profile-email-row .profile-inline-toggle input {
    width: 18px !important;
    height: 18px;
    margin: 0 !important;
}

@media (max-width: 520px) {
    .profile-email-row {
        gap: 10px;
    }

    .profile-email-row .profile-inline-toggle {
        padding: 0 12px;
    }
}


/* ===== Zeer 2.4.9 ===== */
#membersSpaceModal .modal-content {
    max-width: 380px;
}

#membersSpaceList.member-list {
    max-height: 340px;
    margin: 12px 0 6px;
    padding: 0;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

#membersSpaceList .member-item,
#membersSpaceList .member-item.compact {
    padding: 8px 0;
    gap: 10px;
    background: transparent !important;
    border: none !important;
    border-bottom: 1px solid rgba(120, 128, 153, 0.16) !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

#membersSpaceList .member-item:last-child,
#membersSpaceList .member-item.compact:last-child {
    border-bottom: none !important;
}

#membersSpaceList .member-info {
    gap: 10px;
    min-width: 0;
}

#membersSpaceList .member-avatar {
    width: 34px;
    height: 34px;
    margin-right: 0;
    font-size: 13px;
    flex-shrink: 0;
}

#membersSpaceList .member-meta {
    min-width: 0;
    flex: 1;
}

#membersSpaceList .member-name-row {
    gap: 6px;
}

#membersSpaceList .member-name-row > span:first-child {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
}

#membersSpaceList .member-username {
    margin-top: 1px;
    font-size: 11px;
    line-height: 1.2;
}

#membersSpaceList .admin-badge {
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 9px;
    line-height: 1.2;
}

#membersSpaceList .member-actions-trigger {
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    #membersSpaceModal .modal-content {
        padding: 18px;
    }

    #membersSpaceList.member-list {
        max-height: 52vh;
        margin-top: 10px;
    }

    #membersSpaceList .member-item,
    #membersSpaceList .member-item.compact {
        padding: 7px 0;
        gap: 8px;
    }

    #membersSpaceList .member-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    #membersSpaceList .member-name-row > span:first-child {
        font-size: 13px;
    }

    #membersSpaceList .member-username,
    #membersSpaceList .member-actions-trigger {
        font-size: 10px;
    }
}


.create-space-note {
    margin-top: 18px;
    margin-bottom: 6px;
}

@media (max-width: 480px) {
    .create-space-note {
        margin-top: 22px;
        margin-bottom: 4px;
    }
}


/* ===== Zeer 2.4.11 ===== */
.profile-avatar-likes-button {
    border: 1px solid rgba(211, 76, 95, 0.14);
    cursor: pointer;
    padding: 0;
    font-size: 0;
    color: #9aa3bd;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.profile-avatar-likes-button::before {
    content: '♡';
    font-size: 18px;
    line-height: 1;
    color: currentColor;
}

.profile-avatar-likes-button:hover,
.profile-avatar-likes-button:active {
    transform: scale(0.98);
}

.profile-avatar-likes-button.liked {
    background: linear-gradient(135deg, rgba(255,245,247,0.98), rgba(255,255,255,0.98));
    color: #d34c5f;
    box-shadow: 0 12px 28px rgba(211, 76, 95, 0.16);
}

.profile-avatar-likes-button.liked::before {
    content: '❤';
}

#userProfileModal .modal-content {
    max-width: 400px;
}

#userProfileModal .profile-modal-card {
    text-align: center;
}

#userProfileModal .profile-info-compact {
    margin-bottom: 0;
}

#membersSpaceList .member-item,
#membersSpaceList .member-item.compact {
    display: flex;
    align-items: center;
}

#membersSpaceList .member-info {
    flex: 1;
}

#membersSpaceList .member-actions-trigger {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    margin-left: auto;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    font-weight: 700;
    background: transparent;
    border: none;
    color: #7a829b;
}

#membersSpaceList .member-actions-trigger:hover,
#membersSpaceList .member-actions-trigger:active {
    background: rgba(122, 130, 155, 0.12);
}

#membersSpaceList .member-actions-spacer {
    width: 34px;
    min-width: 34px;
    height: 34px;
    margin-left: auto;
}

@media (max-width: 480px) {
    #membersSpaceList .member-actions-trigger,
    #membersSpaceList .member-actions-spacer {
        width: 32px;
        min-width: 32px;
        height: 32px;
    }

    #membersSpaceList .member-actions-trigger {
        font-size: 20px;
    }
}

/* ===== Zeer 2.4.13 invite modal ===== */
.invite-space-modal-content {
    max-width: 440px !important;
}

.invite-space-modal-content h3 {
    margin-bottom: 16px !important;
}

.seg.invite-seg {
    display: flex;
    gap: 8px;
    padding: 6px;
    border-radius: 18px;
    background: var(--surface, #ffffff);
    border: 1px solid var(--line, rgba(18,28,60,.09));
    margin-bottom: 18px;
}

.seg.invite-seg .tab {
    flex: 1;
    text-align: center;
    padding: 11px 10px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 13px;
    color: inherit;
    cursor: pointer;
    transition: .2s ease;
    user-select: none;
}

.seg.invite-seg .tab.active {
    background: var(--surface-2, #f4f7ff);
    box-shadow: var(--card-shadow, 0 18px 46px rgba(33,40,80,.10));
}

.seg.invite-seg .tab:focus-visible {
    outline: 2px solid rgba(13,61,187,.28);
    outline-offset: 2px;
}

.invite-mode-panel {
    display: none;
}

.invite-mode-panel.active {
    display: block;
}

.invite-user-panel,
.invite-links-list-wrap,
.invite-links-create-panel {
    display: grid;
    gap: 12px;
}

.invite-links-list-wrap {
    margin-bottom: 18px;
}

.invite-links-header {
    display: grid;
    gap: 8px;
}

.invite-section-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--z-text, #161a2d);
}

.invite-sub-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--z-muted, #6f7895);
    line-height: 1.4;
}

.invite-link-options-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.invite-option-check {
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid var(--z-line, rgba(18,28,60,.09));
    background: rgba(255,255,255,.72);
    box-shadow: var(--z-card-shadow, 0 18px 46px rgba(33,40,80,.10));
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--z-text, #161a2d);
    cursor: pointer;
}

.invite-option-check input {
    width: 18px !important;
    height: 18px;
    margin: 0 !important;
}

.invite-conditional-fields {
    display: grid;
    gap: 12px;
}

.invite-conditional-fields[hidden] {
    display: none !important;
}

.invite-conditional-fields.single-field {
    grid-template-columns: minmax(0, 1fr);
}

.invite-conditional-fields.double-field {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.invite-conditional-field {
    display: grid;
    gap: 8px;
}

.invite-conditional-field[hidden] {
    display: none !important;
}

.invite-conditional-field input {
    width: 100%;
    margin: 0 !important;
}

.invite-link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 20px;
    border: 1px solid var(--z-line, rgba(18,28,60,.09));
    background: rgba(255,255,255,.78);
    box-shadow: var(--z-card-shadow, 0 18px 46px rgba(33,40,80,.10));
}

.invite-link-main {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.invite-link-line {
    font-size: 13px;
    font-weight: 600;
    color: var(--z-text, #161a2d);
    word-break: break-all;
}

.invite-link-meta {
    font-size: 12px;
    color: var(--z-muted, #6f7895);
}

.invite-copy-icon-btn {
    width: 46px !important;
    min-width: 46px;
    height: 46px;
    padding: 0 !important;
    border-radius: 16px !important;
    border: 1px solid var(--z-line, rgba(18,28,60,.09)) !important;
    background: var(--z-surface-2, #f4f7ff) !important;
    color: var(--z-primary-1, #0d3dbb) !important;
    font-size: 20px !important;
    font-weight: 700;
    margin-top: 0 !important;
    box-shadow: var(--z-card-shadow, 0 18px 46px rgba(33,40,80,.10));
}

@media (max-width: 480px) {
    .invite-link-options-row,
    .invite-conditional-fields.double-field {
        grid-template-columns: 1fr;
    }
}


/* ===== Zeer 2.4.14.1 invite fields visibility fix ===== */
.invite-conditional-fields.single-field {
    grid-template-columns: minmax(0, 1fr) !important;
}

.invite-conditional-fields.double-field {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

/* ===== Zeer 2.5.1 space visuals final fix ===== */
.selected-space-avatar,
.space-avatar-live-preview {
    background: transparent !important;
    box-shadow: none !important;
}

.selected-space-avatar {
    border: none !important;
    padding: 0 !important;
}

.selected-space-avatar .space-avatar-chip {
    box-shadow: 0 8px 18px rgba(51,65,85,0.10);
}

.space-avatar-live-preview {
    background-size: cover !important;
    background-position: center !important;
    color: #fff !important;
}

.messages-area[data-space-background-active="1"] {
    background-color: transparent !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
    background-position: center !important;
}

/* ===== Zeer 2.5.1.1 space settings preview override fix ===== */
#editSpaceModal .space-avatar-live-preview,
#editSpaceModal .space-bg-live-trigger,
#editSpaceModal .space-bg-preset,
#editSpaceModal .space-bg-upload-tile,
#editSpaceModal .space-color-dot {
    margin-top: 0 !important;
    padding: 0 !important;
}

#editSpaceModal .space-avatar-live-preview {
    width: 62px;
    min-width: 62px;
}

#editSpaceModal .space-bg-live-trigger {
    width: 62px;
    min-width: 62px;
}

#editSpaceModal .space-bg-preset,
#editSpaceModal .space-bg-upload-tile {
    width: 100%;
}

#editSpaceModal .space-bg-preset {
    background: transparent !important;
    background-image: none !important;
    color: inherit !important;
    border: 2px solid transparent !important;
    box-shadow: none !important;
    display: block !important;
    overflow: hidden !important;
    cursor: pointer !important;
}

#editSpaceModal .space-bg-preset.active {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12) !important;
}

#editSpaceModal .space-bg-upload-tile {
    border: 1px solid #dfe5f0 !important;
    background: #ffffff !important;
    background-image: none !important;
    box-shadow: none !important;
}

#editSpaceModal .space-avatar-live-preview,
#editSpaceModal .space-bg-live-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#editSpaceModal .space-bg-live-trigger {
    align-items: stretch;
    justify-content: stretch;
}

#editSpaceModal .space-bg-live-thumb,
#editSpaceModal .space-bg-preset-thumb {
    width: 100%;
    height: 100%;
}


/* ===== space avatar picker fix ===== */
#editSpaceModal .space-picker-popover-avatar {
    width: auto !important;
    min-width: 186px;
}

#editSpaceModal .space-avatar-picker-grid {
    display: grid;
    grid-template-columns: auto 54px;
    gap: 12px;
    align-items: stretch;
}

#editSpaceModal .space-color-palette.square {
    display: grid !important;
    grid-template-columns: repeat(3, 32px) !important;
    grid-template-rows: repeat(2, 32px);
    gap: 10px !important;
}

#editSpaceModal .space-color-palette.square .space-color-dot {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    border-radius: 10px !important;
    border: 2px solid transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    appearance: none;
    -webkit-appearance: none;
    background-image: none !important;
    box-shadow: 0 0 0 1px rgba(31,36,55,0.10) !important;
}

#editSpaceModal .space-color-palette.square .space-color-dot[data-color="#667EEA"] { background: #667EEA !important; }
#editSpaceModal .space-color-palette.square .space-color-dot[data-color="#764BA2"] { background: #764BA2 !important; }
#editSpaceModal .space-color-palette.square .space-color-dot[data-color="#4ECDC4"] { background: #4ECDC4 !important; }
#editSpaceModal .space-color-palette.square .space-color-dot[data-color="#45B7D1"] { background: #45B7D1 !important; }
#editSpaceModal .space-color-palette.square .space-color-dot[data-color="#FF8A65"] { background: #FF8A65 !important; }
#editSpaceModal .space-color-palette.square .space-color-dot[data-color="#84A59D"] { background: #84A59D !important; }

#editSpaceModal .space-color-palette.square .space-color-dot.active {
    border-color: #ffffff !important;
    box-shadow: 0 0 0 2px #667eea !important;
}

#editSpaceModal .space-avatar-upload-tile {
    width: 54px !important;
    min-width: 54px !important;
    height: 74px !important;
    min-height: 74px !important;
    align-self: stretch;
    justify-self: stretch;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
    border: 1px solid #dfe5f0 !important;
    background: #ffffff !important;
    background-image: none;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden;
}

#editSpaceModal .space-avatar-upload-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #7b8497;
    font-size: 28px;
    line-height: 1;
    font-weight: 400;
}

#editSpaceModal .space-inline-actions-avatar {
    margin-top: 10px;
    justify-content: flex-end !important;
}


/* ===== Zeer 2.5.5.2 space settings layout ===== */
.space-hidden-description-field {
    display: none !important;
}

#editSpaceModal .modal-content {
    overflow-x: hidden;
}

.space-extra-settings-v2311 {
    margin: 14px 0 14px;
}

.space-visual-controls-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

.space-setting-group-inline {
    align-content: start;
}

.space-compact-picker-inline {
    width: 100%;
}

.space-compact-picker-inline .space-avatar-live-preview,
.space-compact-picker-inline .space-bg-live-trigger {
    width: 100% !important;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    height: auto !important;
    min-height: 96px;
    border-radius: 18px;
}

.space-visual-picker-row {
    display: grid;
    gap: 10px;
    justify-items: start;
}

#editSpaceModal .space-visual-picker-row .space-picker-popover,
#editSpaceModal .space-visual-picker-row .space-picker-popover.wide {
    position: static;
    top: auto;
    left: auto;
    display: none;
    width: min(320px, 100%);
    max-width: 100%;
}

#editSpaceModal .space-visual-picker-row .space-picker-popover.open,
#editSpaceModal .space-visual-picker-row .space-picker-popover.wide.open {
    display: block;
}

#editSpaceModal .space-inline-actions-avatar {
    justify-content: flex-start !important;
}

@media (max-width: 520px) {
    .space-visual-controls-row {
        gap: 10px;
    }

    .space-compact-picker-inline .space-avatar-live-preview,
    .space-compact-picker-inline .space-bg-live-trigger {
        min-height: 82px;
    }
}


/* ===== Zeer 2.5.5.4 UI refinements ===== */
.space-avatar-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.space-premium-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #dff3ff 0%, #8fd1ff 100%);
    box-shadow: 0 6px 14px rgba(61, 145, 224, 0.28);
    border: 1px solid rgba(255,255,255,0.95);
    font-size: 10px;
    line-height: 1;
}

.selected-space-avatar,
.chat-list-item > .space-avatar-wrap,
.space-option > .space-avatar-wrap {
    flex-shrink: 0;
}

.selected-space-avatar {
    margin-right: 10px;
}

.selected-space-avatar .space-premium-badge {
    top: -3px;
    right: -3px;
}

.space-visual-controls-row {
    justify-content: center;
}

.space-setting-group-inline {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.space-compact-picker-inline {
    width: auto;
}

.space-compact-picker-inline .space-avatar-live-preview,
.space-compact-picker-inline .space-bg-live-trigger {
    width: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
    min-height: 64px !important;
    height: 64px !important;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    margin-left: auto;
    margin-right: auto;
}

.space-visual-picker-row {
    justify-items: center;
}

.notification-settings-modal-content h3 {
    margin-bottom: 16px;
}

.notification-status-text {
    margin: 0 0 14px;
    color: #666;
    font-size: 13px;
    line-height: 1.45;
}

.notification-status-card {
    margin: 12px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 12px;
    font-size: 13px;
    color: #555;
}

.notification-toggle-list {
    margin: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notification-toggle-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    cursor: pointer;
    text-align: left;
}

.notification-toggle-row input {
    width: 18px !important;
    min-width: 18px;
    height: 18px;
    margin: 0 !important;
}

.notification-toggle-row span {
    flex: 0 1 auto;
}

.notification-actions-grid {
    display: grid;
    gap: 10px;
    margin: 16px 0;
}

.modal .modal-content button.notification-white-btn {
    background: #ffffff;
    color: #333;
    border: 1px solid #dfe5f0;
    box-shadow: none;
}

.notification-footnote {
    font-size: 12px;
    color: #777;
    line-height: 1.45;
    margin-bottom: 12px;
}

@media (max-width: 520px) {
    .space-compact-picker-inline .space-avatar-live-preview,
    .space-compact-picker-inline .space-bg-live-trigger {
        width: 64px !important;
        min-width: 64px !important;
        max-width: 64px !important;
        min-height: 64px !important;
        height: 64px !important;
    }
}


/* ===== Zeer 2.6.6.1 fixes ===== */
.profile-delete-wrap {
    margin-top: 12px;
    padding-top: 0;
    border-top: 0;
    display: flex;
    justify-content: center;
}

.profile-delete-link,
a.profile-delete-link,
a.profile-delete-link:visited,
a.profile-delete-link:hover,
a.profile-delete-link:focus,
a.profile-delete-link:active {
    display: inline !important;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: #9aa3ba !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    line-height: 1.4 !important;
    text-decoration: underline !important;
    text-underline-offset: 2px;
    cursor: pointer;
    appearance: none !important;
    -webkit-appearance: none !important;
    transform: none !important;
}

a.profile-delete-link:hover,
a.profile-delete-link:focus {
    color: #cf6a7e !important;
}

a.profile-delete-link:active {
    opacity: 0.75;
}

/* ===== Zeer 2.7.1 background preset fix ===== */
#editSpaceModal .space-background-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 10px !important;
}

#editSpaceModal .space-bg-preset-thumb {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    border-radius: 14px !important;
}


/* ========== STARTUP LOADER ========== */
.startup-loader-screen {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top, rgba(255,255,255,0.18), transparent 32%),
        radial-gradient(circle at bottom right, rgba(255,255,255,0.10), transparent 28%),
        linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.startup-loader-screen::before,
.startup-loader-screen::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(8px);
    opacity: 0.45;
    pointer-events: none;
}

.startup-loader-screen::before {
    width: 220px;
    height: 220px;
    background: rgba(255,255,255,0.12);
    top: -60px;
    left: -40px;
}

.startup-loader-screen::after {
    width: 260px;
    height: 260px;
    background: rgba(255,255,255,0.08);
    right: -80px;
    bottom: -80px;
}

.startup-loader-card {
    position: relative;
    z-index: 1;
    width: min(100%, 380px);
    padding: 36px 28px 32px;
    border-radius: 28px;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.22);
    box-shadow: 0 22px 60px rgba(46, 24, 88, 0.34);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    text-align: center;
}

.startup-loader-orbit {
    position: relative;
    width: 132px;
    height: 132px;
    margin: 0 auto 22px;
}

.startup-loader-core {
    position: absolute;
    inset: 35px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #dbe6ff 35%, #8fa7ff 68%, rgba(255,255,255,0.22) 100%);
    box-shadow: 0 0 34px rgba(255,255,255,0.45);
    animation: loaderPulse 1.8s ease-in-out infinite;
}

.startup-loader-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    mix-blend-mode: screen;
}

.startup-loader-ring-a {
    border-top-color: rgba(255,255,255,0.95);
    border-right-color: rgba(255,255,255,0.28);
    animation: loaderSpin 2.7s linear infinite;
}

.startup-loader-ring-b {
    inset: 10px;
    border-left-color: rgba(187, 221, 255, 0.9);
    border-bottom-color: rgba(255,255,255,0.18);
    animation: loaderSpinReverse 2.1s linear infinite;
}

.startup-loader-ring-c {
    inset: 22px;
    border-top-color: rgba(207, 178, 255, 0.95);
    border-left-color: rgba(255,255,255,0.22);
    animation: loaderSpin 1.65s linear infinite;
}

.startup-loader-glow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 18px;
    margin-left: -9px;
    margin-top: -57px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 16px rgba(255,255,255,0.95), 0 0 32px rgba(196,225,255,0.7);
    animation: loaderOrbit 1.65s linear infinite;
}

.startup-loader-brand {
    color: #fff;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 14px;
    text-shadow: 0 6px 24px rgba(44, 17, 87, 0.28);
}

.startup-loader-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.startup-loader-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    animation: loaderDots 1.2s ease-in-out infinite;
}

.startup-loader-dots span:nth-child(2) { animation-delay: 0.15s; }
.startup-loader-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes loaderSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes loaderSpinReverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

@keyframes loaderPulse {
    0%, 100% { transform: scale(0.96); opacity: 0.95; }
    50% { transform: scale(1.06); opacity: 1; }
}

@keyframes loaderOrbit {
    from { transform: rotate(0deg) translateY(-48px) rotate(0deg); }
    to { transform: rotate(360deg) translateY(-48px) rotate(-360deg); }
}

@keyframes loaderDots {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-6px); opacity: 1; }
}

@media (max-width: 480px) {
    .startup-loader-card {
        padding: 32px 22px 28px;
        border-radius: 24px;
    }
    .startup-loader-orbit {
        width: 116px;
        height: 116px;
        margin-bottom: 18px;
    }
    .startup-loader-core { inset: 31px; }
    .startup-loader-brand { font-size: 26px; }
}
