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

:root {
    --orange-primary: #FF4F11;
    --orange-light: #FF8C42;
    --orange-lighter: #FFA500;
    --purple-primary: #7700FF;
    --purple-light: #9D4EDD;
    --purple-lighter: #B77FE8;
    --bg-gradient: linear-gradient(135deg, #FF6B35 0%, #8B4CBF 100%);
    --bg-light: #FFF5F0;
    --bg-lighter: #FFFBF9;
    --text-primary: #1a1a1a;
    --text-secondary: #707579;
    --border-color: #FFE5D9;
    --shadow: rgba(255, 107, 53, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    overflow: hidden;
}

/* ========== АВТОРИЗАЦИЯ ========== */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-box {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px var(--shadow);
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border: 1px solid rgba(255, 107, 53, 0.2);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    font-size: 3em;
    font-weight: 700;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 25px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all 0.3s;
    position: relative;
}

.auth-tab.active {
    color: var(--orange-primary);
    font-weight: 600;
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--bg-gradient);
}

.auth-content {
    display: none;
}

.auth-content.active {
    display: block;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.form-row .auth-input {
    flex: 1;
    margin-bottom: 0;
}

.auth-input {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
    background: var(--bg-lighter);
}

.auth-input:focus {
    outline: none;
    border-color: var(--orange-primary);
    background: white;
}

.auth-select {
    width: 100%;
    padding: 14px 40px 14px 16px;
    margin-bottom: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
    background-color: var(--bg-lighter);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23FF6B35' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

.auth-select {
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.auth-select:focus {
    outline: none;
    border-color: var(--orange-primary);
    background-color: white;
}

.auth-select option {
    padding: 10px;
    background: white;
}

.auth-select option:disabled {
    color: #ccc;
    background-color: #f5f5f5;
}

.auth-button {
    width: 100%;
    padding: 14px;
    background: var(--bg-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

.auth-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow);
}

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

.error-message {
    color: #e74c3c;
    margin-top: 10px;
    text-align: center;
    font-size: 14px;
    min-height: 20px;
}

/* ========== ОСНОВНОЙ ИНТЕРФЕЙС TELEGRAM ========== */
.telegram-app {
    display: flex;
    height: 100vh;
    width: 100vw;
    background: white;
}

/* Боковая панель */
.sidebar {
    width: 320px;
    background: var(--bg-lighter);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sidebar-header {
    background: var(--bg-gradient);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.sidebar-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

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

.menu-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.menu-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.search-button,
.notifications-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    width: 36px;
    height: 36px;
    box-sizing: border-box;
}

.search-button:hover,
.notifications-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Badge for notifications button */
.notifications-button {
    position: relative;
}

.notifications-button .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    padding: 0;
    min-width: 0;
    font-size: 0;
    background: var(--orange-primary);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.search-container {
    padding: 12px;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.search-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    background: var(--bg-lighter);
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--orange-primary);
    background: white;
}

.no-search-results {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.chats-list {
    flex: 1;
    overflow-y: auto;
    background: white;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--bg-lighter);
    position: relative;
}

.chats-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 16px;
    opacity: 0.5;
}

.chat-item:hover {
    background: var(--bg-light);
}

.chat-item.active {
    background: var(--bg-light);
    border-left: 3px solid var(--orange-primary);
}

.chat-avatar-small {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
    overflow: hidden;
}

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

.chat-item-info {
    flex: 1;
    min-width: 0;
    position: relative;
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-item-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-time {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.chat-item-preview-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.chat-item-preview {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.chat-item-status {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.online-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--orange-primary);
}

.unread-badge {
    background: var(--orange-primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    min-width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.unread-badge.muted {
    background: #9e9e9e;
    color: white;
}

.sidebar-footer {
    padding: 12px 16px;
    background: var(--bg-lighter);
    border-top: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    transition: background 0.2s;
}

.user-profile:hover {
    background: var(--bg-light);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

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

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.user-status {
    font-size: 12px;
    color: var(--orange-primary);
    font-weight: 500;
}

/* Основная область чата */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    height: 100vh;
}

.chat-header {
    background: var(--bg-gradient);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 2px 8px var(--shadow);
}

.pinned-message {
    background: #fff3e0;
    padding: 10px 16px;
    padding-left: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    overflow: hidden;
    width: 100%;
    margin: 0;
    border-radius: 0;
    border-left: 4px solid var(--orange-primary);
    border-bottom: 1px solid rgba(230, 126, 34, 0.3);
}

.pinned-message-content {
    display: grid;
    grid-template-columns: auto 1fr 30px;
    width: 100%;
    align-items: center;
    gap: 8px;
}

.pinned-label {
    color: #e65100;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.pinned-text {
    color: #333;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-self: start;
    max-width: 100%;
}

.pinned-message-content .unpin-btn {
    justify-self: end;
    display: flex;
    justify-content: flex-end;
}

.pinned-message {
    cursor: pointer;
}

.pinned-message:hover {
    background: #ffe0b2;
}

.unpin-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--orange-primary);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.unpin-btn:hover {
    color: var(--error);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px;
    border-radius: 8px;
    transition: background 0.2s;
}

.chat-header-info:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    overflow: hidden;
}

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

.chat-info {
    flex: 1;
}

.chat-title {
    font-weight: 600;
    font-size: 16px;
    color: white;
}

.chat-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 2px;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

.chat-header-info {
    display: flex;
    align-items: center;
    flex: 1;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.chat-header-info:hover {
    background: rgba(0, 0, 0, 0.05);
}

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

.header-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.header-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    background: #f0f0f0;
    background-image: 
        radial-gradient(circle at 20px 20px, rgba(255, 107, 53, 0.05) 2px, transparent 0),
        radial-gradient(circle at 60px 60px, rgba(139, 76, 191, 0.05) 2px, transparent 0);
    background-size: 80px 80px;
    padding: 20px;
    position: relative;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 800px;
    margin: 0 auto;
}

.message-wrapper {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    cursor: default;
    transition: opacity 0.15s;
    overflow: visible;
}

.message-wrapper:hover {
    opacity: 0.85;
}

.message-wrapper.selected {
    opacity: 1;
}

.message-wrapper.selected .message {
    background: rgba(255, 107, 53, 0.15);
}

.message-wrapper.selected .message.own {
    background: rgba(138, 43, 226, 0.4);
}

.messages-container.no-scroll {
    overflow: hidden;
}

/* Кнопка прокрутки вниз */
.scroll-to-bottom {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--orange-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
    transition: transform 0.2s, opacity 0.3s ease;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
}

.scroll-to-bottom.visible {
    opacity: 1;
    pointer-events: auto;
}

.scroll-to-bottom:hover {
    transform: scale(1.1);
    background: #e67e22;
}

.scroll-to-bottom:active {
    transform: scale(0.95);
}

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

.message-wrapper.own {
    justify-content: flex-end;
}

.message-wrapper.other {
    justify-content: flex-start;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--purple-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 65%;
    min-width: 150px;
    padding: 12px 16px;
    border-radius: 20px;
    animation: messageAppear 0.3s ease-out;
    word-wrap: break-word;
    position: relative;
    overflow: visible;
}

.message.own {
    align-self: flex-end;
    background: var(--purple-primary);
    color: white;
    border-bottom-right-radius: 4px;
    margin-right: 12px;
}

.message.other {
    align-self: flex-start;
    background: white;
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    margin-left: 12px;
}

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

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-direction: column;
    align-items: flex-start;
}

.message-username {
    font-weight: 600;
    font-size: 14px;
}

.message-position {
    font-size: 12px;
    font-weight: 600;
    margin-top: 2px;
    color: #d0d0d0 !important;
}

.message-info {
    font-size: 14px !important;
    font-weight: 600 !important;
    margin-top: 0px !important;
    color: #d0d0d0 !important;
}

.message.own .message-username {
    color: white;
}

.message.other .message-username {
    color: var(--purple-primary);
}

.message.other .message-position {
    color: #d0d0d0 !important;
}

.message.other .message-info {
    color: #d0d0d0 !important;
}

.message-text {
    font-size: 15px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 4px;
    color: inherit;
}

/* Стили для @-mentions (обращений к пользователям) */
.message-text .mention {
    color: var(--orange-primary);
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.message-text .mention:hover {
    opacity: 0.7;
    text-decoration: underline;
}

.message-footer {
    display: flex;
    align-items: flex-end;
    align-content: flex-end;
    gap: 8px;
    margin-top: 2px;
    flex-wrap: wrap;
    min-height: 16px;
    position: relative;
}

.message-footer .message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    align-items: flex-end;
    align-content: flex-end;
    flex-shrink: 1;
    flex-grow: 1;
}

.message-footer .message-info-group {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: auto;
}

.message-time {
    font-size: 11px;
    opacity: 0.8;
    color: inherit;
    flex-shrink: 0;
    line-height: 1.2;
}

.message-status {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
}

.message.own .message-status {
    color: rgba(255, 255, 255, 0.7);
}

/* Системные сообщения */
.message.system-message {
    align-self: center;
    background: transparent;
    box-shadow: none;
    padding: 8px 16px;
    min-width: auto;
    max-width: 80%;
    text-align: center;
}

.message.system-message .message-content {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #888 !important;
}

.message-status svg {
    width: 14px;
    height: 14px;
}

/* Статус: ошибка отправки */
.message-status.error {
    color: #e74c3c;
}

.message-status.error svg {
    fill: #e74c3c;
}

/* Статус: отправлено (одна галочка) */
.message-status.sent {
    color: rgba(255, 255, 255, 0.7);
}

.message-status.sent svg {
    fill: rgba(255, 255, 255, 0.7);
}

/* Статус: прочитано (две галочки) */
.message-status.read {
    color: #3498db;
}

.message-status.read svg {
    fill: #3498db;
}

/* Панель ввода */
.input-area {
    display: flex;
    flex-direction: column;
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 12px 20px;
    width: 100%;
}

.input-area .reply-preview {
    max-width: 100%;
    margin: 0 auto 12px auto;
}

.input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    width: 100%;
    max-width: 800px;
    position: relative;
}

/* Выпадающий список @-mentions */
.mentions-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-bottom: 8px;
}

.mentions-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.mentions-dropdown-item:first-child {
    border-radius: 12px 12px 0 0;
}

.mentions-dropdown-item:last-child {
    border-radius: 0 0 12px 12px;
}

.mentions-dropdown-item:hover,
.mentions-dropdown-item.selected {
    background: var(--bg-light);
}

.mentions-dropdown-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--orange-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.mentions-dropdown-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mentions-dropdown-info {
    flex: 1;
    min-width: 0;
}

.mentions-dropdown-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mentions-dropdown-username {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========== КНОПКА СКРЕПКИ (ПРИКРЕПИТЬ ФАЙЛ) ========== */
.attach-button {
    background: none;
    border: none;
    color: var(--orange-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

/* Emoji panel */
.emoji-panel {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-bottom: 8px;
    display: none;
    flex-direction: column;
}

.emoji-panel.show {
    display: flex;
}

.emoji-categories {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-lighter);
    border-radius: 12px 12px 0 0;
    overflow-x: auto;
}

.emoji-category {
    flex: 1;
    padding: 10px 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
    border-bottom: 2px solid transparent;
}

.emoji-category:hover {
    color: var(--orange-primary);
    background: rgba(255, 107, 53, 0.05);
}

.emoji-category.active {
    color: var(--orange-primary);
    border-bottom-color: var(--orange-primary);
    font-weight: 600;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 12px;
    flex: 1;
    overflow-y: auto;
}

.emoji-item {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.emoji-item:hover {
    background: var(--bg-light);
    transform: scale(1.1);
}

.emoji-item:active {
    transform: scale(0.95);
}
/* Vertical emoji panel layout */
.emoji-panel {
    display: none;
    flex-direction: column;
    max-height: 350px;
    width: 300px;
    left: auto;
    right: 0;
    bottom: 100%;
    top: auto;
    border-radius: 8px;
    overflow: hidden;
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.emoji-panel.show {
    display: flex;
}

.emoji-categories-vertical {
    display: flex;
    flex-direction: column;
    width: 140px;
    background: var(--bg-lighter);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    flex-shrink: 0;
}

.emoji-category-vertical {
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: left;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.emoji-category-vertical:hover {
    color: var(--orange-primary);
    background: rgba(255, 107, 53, 0.05);
}

.emoji-category-vertical.active {
    color: var(--orange-primary);
    border-left-color: var(--orange-primary);
    font-weight: 600;
    background: rgba(255, 107, 53, 0.08);
}

.emoji-grid-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

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

/* Emoji sections (vertical list of categories) */
.emoji-sections {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.emoji-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.emoji-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--orange-primary);
    margin-bottom: 2px;
    padding-bottom: 0;
    border-bottom: none;
}

.emoji-section-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 2px;
}
/* Стили скроллбара для панели смайликов */
.emoji-sections::-webkit-scrollbar {
    width: 8px;
}
.emoji-sections::-webkit-scrollbar-track {
    background: transparent;
}
.emoji-sections::-webkit-scrollbar-thumb {
    background: var(--orange-primary);
    border-radius: 4px;
}
.emoji-sections::-webkit-scrollbar-thumb:hover {
    background: var(--orange-light);
}
.emoji-item {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.15s;
    user-select: none;
    background: none;
    border: none;
    outline: none;
    box-shadow: none;
}

.emoji-item:hover {
    transform: scale(1.1);
}

.emoji-item:active {
    transform: scale(0.95);
}
.emoji-button {
    background: none;
    border: none;
    color: var(--orange-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
.microphone-button {
    background: none;
    border: none;
    color: var(--orange-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
.microphone-button.recording {
    background: var(--orange-primary);
    color: white;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 79, 17, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 79, 17, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 79, 17, 0); }
}

/* ========== ГОЛОСОВОЕ ПРИ ЗАПИСИ (на месте микрофона) ========== */
.voice-recording-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    border-radius: 24px;
    padding: 8px 12px 8px 14px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
    flex: 1;
    min-width: 0;
    transition: all 0.3s ease;
    height: 44px;
    box-sizing: border-box;
}

/* Квадрат для остановки записи на месте микрофона */
.voice-record-stop {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.voice-record-stop svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.voice-recording-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 20px;
    flex-shrink: 0;
}

.voice-recording-wave span {
    width: 3px;
    background: white;
    border-radius: 2px;
    animation: waveAnimation 1s ease-in-out infinite;
}

.voice-recording-wave span:nth-child(1) { height: 6px; animation-delay: 0s; }
.voice-recording-wave span:nth-child(2) { height: 14px; animation-delay: 0.1s; }
.voice-recording-wave span:nth-child(3) { height: 10px; animation-delay: 0.2s; }
.voice-recording-wave span:nth-child(4) { height: 18px; animation-delay: 0.3s; }
.voice-recording-wave span:nth-child(5) { height: 8px; animation-delay: 0.4s; }
.voice-recording-wave span:nth-child(6) { height: 12px; animation-delay: 0.5s; }
.voice-recording-wave span:nth-child(7) { height: 16px; animation-delay: 0.6s; }
.voice-recording-wave span:nth-child(8) { height: 6px; animation-delay: 0.7s; }

@keyframes waveAnimation {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

.voice-recording-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.voice-recording-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.voice-recording-close:active {
    transform: scale(0.95);
}

.voice-play-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
    padding: 0;
    margin-left: 4px;
}

.voice-play-btn:hover {
    transform: scale(1.15);
}

.voice-play-btn:active {
    transform: scale(0.95);
}

/* Волна воспроизведения */
.voice-waveform {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1px;
    height: 20px;
    flex: 1;
    min-width: 0;
    padding: 0 4px;
    position: relative;
    margin-left: 8px;
}

.voice-waveform span {
    width: 2px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 1px;
    transition: background 0.1s ease;
    flex-shrink: 0;
}

.voice-waveform span.played {
    background: white;
}

/* Таймер записи */
.voice-recording-timer {
    color: white;
    font-size: 14px;
    font-weight: 600;
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

/* ========== ГОЛОСОВЫЕ СООБЩЕНИЯ В ЧАТЕ (ТЕЛЕГРАМ СТИЛЬ) ========== */
.voice-message-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin: 4px 0;
    max-width: 260px;
}

.chat-voice-play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--orange-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s, background 0.2s;
}

.chat-voice-play-btn:hover {
    transform: scale(1.1);
    background: #e67e22;
}

.chat-voice-play-btn:active {
    transform: scale(0.95);
}

.chat-voice-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
    height: 20px;
}

.chat-voice-waveform span {
    width: 3px;
    height: 6px;
    background: rgba(255, 107, 53, 0.4);
    border-radius: 2px;
    flex-shrink: 0;
    transition: background 0.1s;
}

.chat-voice-waveform span.played {
    background: var(--orange-primary);
}

.chat-voice-duration {
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* Для своих сообщений */
.message.own .chat-voice-play-btn {
    background: rgba(255, 255, 255, 0.9);
    color: var(--purple-primary);
}

.message.own .chat-voice-waveform span {
    background: rgba(255, 255, 255, 0.3);
}

.message.own .chat-voice-waveform span.played {
    background: rgba(255, 255, 255, 0.9);
}

.message.own .chat-voice-duration {
    color: rgba(255, 255, 255, 0.7);
}
.attach-button:hover,
.emoji-button:hover,
.microphone-button:hover {
    background: var(--bg-light);
}

.message-input-field {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 15px;
    background: var(--bg-lighter);
    transition: border-color 0.2s, background 0.2s;
    resize: none;
    box-sizing: border-box;
    overflow: hidden;
    min-height: 44px;
}

.message-input-field::-webkit-scrollbar {
    display: none;
}

.message-input-field:focus {
    outline: none;
    border-color: var(--orange-primary);
    background: white;
}

/* Стили для textarea (многострочный ввод) */
.message-input-field.textarea {
    resize: none;
    overflow: hidden;
    min-height: 44px;
    max-height: 150px;
    line-height: 1.4;
    font-family: inherit;
}

.send-button {
    background: var(--bg-gradient);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px var(--shadow);
}

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

/* Меню настроек */
.settings-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.settings-header {
    background: var(--bg-gradient);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: white;
}

.back-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.settings-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 8px;
}

.settings-item:hover {
    background: var(--bg-light);
}

.settings-item span {
    font-size: 16px;
    color: var(--text-primary);
}

.settings-item svg {
    color: var(--text-secondary);
}

/* Скроллбары */
.chats-list::-webkit-scrollbar,
.messages-container::-webkit-scrollbar,
.settings-content::-webkit-scrollbar {
    width: 8px;
}

.chats-list::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track,
.settings-content::-webkit-scrollbar-track {
    background: transparent;
}

.chats-list::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb,
.settings-content::-webkit-scrollbar-thumb {
    background: var(--bg-gradient);
    border-radius: 4px;
}

.chats-list::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover,
.settings-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--orange-light) 0%, var(--purple-light) 100%);
}

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: absolute;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .chat-area {
        width: 100%;
    }
}

/* Утилиты */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ========== МЕНЮ РЕАКЦИЙ ========== */
.reactions-menu {
    position: fixed;
    z-index: 10001;
    background: white;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 2px;
    animation: reactionsMenuAppear 0.15s ease-out;
    min-width: auto;
}

@keyframes reactionsMenuAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.reaction-emoji {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.15s ease;
    user-select: none;
}

.reaction-emoji:hover {
    background: var(--bg-light);
    transform: scale(1.3);
}

.reaction-emoji:active {
    transform: scale(1.1);
}

.reactions-more {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    margin-left: 4px;
    background: var(--bg-light);
}

.reactions-more:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* Панель дополнительных смайликов для реакций */
.reactions-emoji-panel {
    position: fixed;
    z-index: 10002;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 4px;
    max-width: 302px;
    max-height: 280px;
    overflow-y: auto;
    animation: reactionsMenuAppear 0.15s ease-out;
}

.reaction-emoji-item {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.reaction-emoji-item:hover {
    background: var(--bg-light);
    transform: scale(1.2);
}

/* Реакции под сообщением */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0;
    border: 0;
    outline: none;
    align-items: flex-end;
    max-width: 100%;
    line-height: 1;
}

.message-reactions:hover,
.message-reactions:focus,
.message-reactions:active {
    border: 0;
    outline: none;
    box-shadow: none;
}

.message-reaction {
    display: flex;
    align-items: center;
    background: var(--bg-light);
    border-radius: 10px;
    padding: 2px 4px;
    cursor: pointer;
    min-width: auto;
    height: 22px;
    border: 0;
    outline: none;
    box-shadow: none;
}

/* Реакции на чужих сообщениях - прозрачный оранжевый */
.message:not(.own) .message-reaction {
    background: rgba(255, 107, 53, 0.2) !important;
}

/* Реакции на своих сообщениях */
.message.own .message-reaction {
    background: #9D4EDD !important;
}

/* ========== МНОЖЕСТВЕННОЕ ВЫДЕЛЕНИЕ СООБЩЕНИЙ ========== */

/* Выделенные сообщения в режиме множественного выделения (как .highlighted) */
.message-wrapper.selection-selected {
    position: relative;
    z-index: 10;
}

.message-wrapper.selection-selected::before {
    content: '';
    position: absolute;
    left: 50%;
    right: auto;
    width: 100vw;
    transform: translateX(-50%);
    top: -4px;
    bottom: -4px;
    background: rgba(255, 107, 53, 0.15);
    border-left: 4px solid var(--orange-primary);
    z-index: -1;
    pointer-events: none;
    border-radius: 8px;
}

/* Панель выделения (заменяет input-area) */
.selection-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 12px 20px;
    width: 100%;
    box-sizing: border-box;
}

.selection-bar.active,
.selection-bar:not(.hidden) {
    display: flex;
}

.selection-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.selection-bar-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.selection-bar-close:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.selection-bar-close svg {
    width: 24px;
    height: 24px;
}

.selection-bar-count {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.selection-bar-count span {
    color: var(--orange-primary);
}

.selection-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selection-bar-btn {
    background: var(--bg-light);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 10px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.selection-bar-btn:hover {
    background: var(--border-color);
}

.selection-bar-btn.danger {
    background: #e74c3c;
    color: white;
}

.selection-bar-btn.danger:hover {
    background: #c0392b;
}

.selection-bar-btn.primary {
    background: var(--orange-primary);
    color: white;
}

.selection-bar-btn.primary:hover {
    background: #e67e22;
}

.selection-bar-btn svg {
    width: 18px;
    height: 18px;
}

.message-reaction:hover,
.message-reaction:focus,
.message-reaction:active,
.message-reaction:visited,
.message-reaction:target,
.message-reaction:focus-within {
    background: var(--bg-light) !important;
    border: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}

.message-reaction:hover *,
.message-reaction:focus *,
.message-reaction:active *,
.message-reaction:visited *,
.message-reaction:target *,
.message-reaction:focus-within * {
    background: transparent !important;
    border: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
}

.message-reaction .reaction-emoji,
.message-reaction .reaction-emoji:hover,
.message-reaction .reaction-emoji:focus,
.message-reaction .reaction-emoji:active {
    font-size: 14px;
    line-height: 1;
    margin: 0;
    padding: 0;
    border: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    -webkit-tap-highlight-color: transparent !important;
    transform: none !important;
}

.message-reaction .reaction-count {
    font-size: 10px;
    color: var(--text-secondary);
    margin-left: 1px;
}

.message-reaction .reaction-avatars {
    display: flex;
    margin-left: 1px;
}

.message-reaction .reaction-avatar {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-gradient) !important;
    color: white;
    font-size: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: -2px;
    border: none;
}

.message-reaction .reaction-avatar:hover,
.message-reaction .reaction-avatar:focus,
.message-reaction .reaction-avatar:active {
    background: var(--bg-gradient) !important;
}

.message-reaction .reaction-avatar:first-child {
    margin-left: 0;
}

.message-reaction .reaction-avatar-img,
.message-reaction img.reaction-avatar-img,
div.message-reactions div.message-reaction img.reaction-avatar-img {
    width: 14px !important;
    height: 14px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    margin-left: -2px !important;
    border: none !important;
    display: inline-block !important;
    vertical-align: middle !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

.message-reaction .reaction-avatars {
    display: flex !important;
    align-items: center !important;
}

.message-reaction .reaction-avatar-img:first-child {
    margin-left: 0;
}

/* ========== КОНТЕКСТНОЕ МЕНЮ ========== */
.context-menu {
    position: fixed;
    z-index: 10000;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 6px;
    min-width: 180px;
    animation: contextMenuAppear 0.15s ease-out;
    overflow: hidden;
}

@keyframes contextMenuAppear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 15px;
    border-radius: 6px;
    transition: background-color 0.15s;
    user-select: none;
}

.context-menu-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.context-menu-item span {
    flex: 1;
}

.context-menu-item:hover {
    background: var(--bg-light);
}

.context-menu-item:hover svg {
    color: var(--text-primary);
}

.context-menu-item:active {
    background: var(--border-color);
}

/* Красная кнопка удаления */
.context-menu-item.delete {
    color: #e74c3c;
}

.context-menu-item.delete svg {
    color: #e74c3c;
}

.context-menu-item.delete:hover {
    background: rgba(231, 76, 60, 0.1);
}

.context-menu-item.delete:hover svg {
    color: #e74c3c;
}

/* Опасные действия в контекстном меню */
.context-menu-item.danger {
    color: #e74c3c;
}

.context-menu-item.danger svg {
    color: #e74c3c;
}

.context-menu-item.danger:hover {
    background: rgba(231, 76, 60, 0.1);
}

.context-menu-item.danger:hover svg {
    color: #e74c3c;
}

.context-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* ========== УДАЛЕННЫЕ СООБЩЕНИЯ И РЕДАКТИРОВАНИЕ ========== */
.message-deleted {
    color: #999;
    font-style: italic;
}

.edit-input {
    font-family: inherit;
}

.edited-badge {
    color: #999;
    font-size: 11px;
    margin-left: 4px;
}

/* ========== ПРЕВЬЮ ОТВЕТА В ПОЛЕ ВВОДА ========== */
.reply-preview {
    background: white;
    border-left: 4px solid var(--orange-primary);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reply-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.reply-preview-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--orange-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reply-preview-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.reply-preview-close:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.reply-preview-sender {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.reply-preview-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ========== ИНДИКАТОР ОТВЕТА В СООБЩЕНИИ ========== */
.reply-indicator {
    background: rgba(255, 107, 53, 0.1);
    border-left: 3px solid var(--orange-primary);
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.reply-indicator:hover {
    background: rgba(255, 107, 53, 0.2);
}

.message.own .reply-indicator {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: rgba(255, 255, 255, 0.5);
}

.message.own .reply-indicator:hover {
    background: rgba(255, 255, 255, 0.25);
}

.reply-indicator-icon {
    flex-shrink: 0;
    color: var(--orange-primary);
}

.message.own .reply-indicator-icon {
    color: rgba(255, 255, 255, 0.7);
}

.reply-indicator-content {
    flex: 1;
    min-width: 0;
}

.reply-indicator-sender {
    font-size: 12px;
    font-weight: 600;
    color: var(--orange-primary);
    margin-bottom: 2px;
}

.message.own .reply-indicator-sender {
    color: rgba(255, 255, 255, 0.9);
}

.reply-indicator-text {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message.own .reply-indicator-text {
    color: rgba(255, 255, 255, 0.7);
}

/* ========== ПОДСВЕЧИВАНИЕ СООБЩЕНИЯ ========== */
.message-wrapper.highlighted {
    position: relative;
    z-index: 10;
}

.message-wrapper.highlighted::before {
    content: '';
    position: absolute;
    left: 50%;
    right: auto;
    width: 100vw;
    transform: translateX(-50%);
    top: -4px;
    bottom: -4px;
    background: rgba(255, 107, 53, 0.15);
    border-left: 4px solid var(--orange-primary);
    animation: highlight-bar 2s ease-out forwards;
    z-index: -1;
    pointer-events: none;
}

@keyframes highlight-bar {
    0% {
        background: rgba(255, 107, 53, 0.2);
    }
    70% {
        background: rgba(255, 107, 53, 0.2);
    }
    100% {
        background: transparent;
    }
}

/* ========== ПРИВЕТСТВЕННЫЙ ЭКРАН ========== */
.welcome-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.welcome-content {
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.welcome-icon {
    margin-bottom: 24px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.welcome-content h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.welcome-content p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.welcome-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.welcome-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--orange-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    flex: 1;
    min-width: 150px;
    max-width: 200px;
}

.welcome-button:hover {
    background: #e67e22;
}

.welcome-button.secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.welcome-button.secondary:hover {
    background: var(--bg-light);
    border-color: var(--orange-primary);
    color: var(--orange-primary);
}

/* ========== ПУСТОЙ СПИСОК ЧАТОВ ========== */
.no-chats-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    text-align: center;
}

.no-chats-message svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-chats-message p {
    font-size: 16px;
    margin: 0;
}

.no-chats-hint {
    font-size: 14px !important;
    margin-top: 8px !important;
    opacity: 0.7;
}

/* ========== БОКОВОЕ МЕНЮ ========== */
.side-menu {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100%;
    background: white;
    z-index: 2000;
    transition: left 0.3s ease-out;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.side-menu.open {
    left: 0;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

.side-menu-header {
    background: var(--bg-gradient);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: white;
}

.side-menu-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 24px;
    flex-shrink: 0;
}

.side-menu-user-info {
    flex: 1;
    min-width: 0;
}

.side-menu-username {
    font-size: 18px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.side-menu-status {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 4px;
}

.side-menu-items {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.side-menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.side-menu-item-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.side-menu-item:hover {
    background: var(--bg-light);
}

.side-menu-item svg {
    color: var(--orange-primary);
    flex-shrink: 0;
}

.side-menu-item span {
    font-size: 16px;
    color: var(--text-primary);
}

.side-menu-item .badge {
    position: absolute;
    right: 20px;
    background: var(--orange-primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.side-menu-item.logout-item {
    color: #e74c3c;
}

.side-menu-item.logout-item svg {
    color: #e74c3c;
}

.side-menu-item.logout-item span {
    color: #e74c3c;
}

.side-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* ========== МОДАЛЬНЫЕ ОКНА ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.2s ease-out;
}

/* Публичный профиль показывается поверх списка коллег */
#public-profile-modal {
    z-index: 10000;
}
/* Модальные окна, открывающиеся поверх информации о чате */
#edit-chat-modal,
#edit-chat-participants-modal,
#profile-view-modal {
    z-index: 5001;
}

.modal.show {
    display: flex;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideUp 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--orange-primary);
}

/* Для модального окна пересылки - особый стиль заголовка */
#forward-message-modal .modal-header h2 {
    color: var(--orange-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--orange-primary);
    color: white;
}

.modal-body {
    padding: 24px;
}

/* ========== МОДАЛЬНОЕ ОКНО СОЗДАНИЯ ГРАФИКА ========== */
.create-schedule-modal-content {
    max-width: 550px;
}

.schedule-section {
    margin-bottom: 20px;
    padding: 0 0 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.schedule-section:last-of-type {
    border-bottom: none;
}

.schedule-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.schedule-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
}

.schedule-section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.schedule-search-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.schedule-search-wrapper .schedule-member-search-container {
    position: absolute;
    top: 100%;
    right: 0;
    width: 280px;
    z-index: 10;
    margin-top: 4px;
}

/* Круглые кнопки добавления */
.add-circle-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid var(--orange-primary);
    color: var(--orange-primary);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.add-circle-btn:hover {
    background: var(--orange-primary);
    color: white;
}

.add-editor-circle-btn {
    border-color: var(--purple-primary);
    color: var(--purple-primary);
}

.add-editor-circle-btn:hover {
    background: var(--purple-primary);
    color: white;
}

.add-reader-circle-btn {
    border-color: #36B37E;
    color: #36B37E;
}

.add-reader-circle-btn:hover {
    background: #36B37E;
    color: white;
}

/* Убираем старые стили кнопок (теперь используются круглые) */
.add-group-btn,
.add-editor-btn,
.add-reader-btn {
    display: none;
}

.schedule-group-container {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px dashed var(--border-color);
}

.schedule-users-container {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px dashed var(--border-color);
}

/* Подсказки (скрыты) */
.schedule-hint {
    display: none;
}

/* Серый label для формы */
.form-label-gray {
    color: var(--text-secondary) !important;
    font-size: 14px;
    font-weight: 500;
}

/* Код графика */
.schedule-code-container {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    max-width: 280px;
}

.schedule-code-input {
    flex: 1;
    font-family: monospace;
    font-size: 16px;
    letter-spacing: 2px;
    text-align: center;
    background: var(--bg-lighter);
    border-color: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.schedule-code-input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: var(--bg-lighter);
}

.copy-code-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.copy-code-btn:hover {
    background: var(--orange-primary);
    border-color: var(--orange-primary);
    color: white;
}

/* Блок группы в модальном окне создания графика */
.schedule-group-block {
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

#schedule-groups-container {
    min-height: 0;
}

.schedule-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.schedule-group-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.remove-group-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.remove-group-btn:hover {
    background: var(--orange-primary);
    color: white;
}

/* Форма с инлайн элементами */
.form-group-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

/* Стили для отображения пользователей (редакторы/читатели) */
.schedule-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-lighter);
    border-radius: 8px;
    margin-bottom: 8px;
}

.schedule-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.schedule-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.schedule-user-info {
    flex: 1;
    min-width: 0;
}

.schedule-user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.schedule-user-username {
    font-weight: 400;
    font-size: 13px;
    color: var(--text-secondary);
}

.schedule-user-position {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.remove-user-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.remove-user-btn:hover {
    background: var(--orange-primary);
    color: white;
}

.schedule-members-list,
.schedule-users-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 32px;
}

.schedule-member-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-lighter);
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-primary);
}

.schedule-member-tag .remove-tag {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transition: all 0.2s;
}

.schedule-member-tag .remove-tag:hover {
    background: var(--orange-primary);
    color: white;
}

.add-member-btn-small {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px dashed var(--text-secondary);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.add-member-btn-small:hover {
    border-color: var(--orange-primary);
    color: var(--orange-primary);
}

.schedule-member-search-container {
    margin-top: 12px;
}

.schedule-members-search-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 8px;
    background: white;
}

.schedule-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--bg-lighter);
}

.schedule-search-item:last-child {
    border-bottom: none;
}

.schedule-search-item:hover {
    background: var(--bg-light);
}

.schedule-search-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.schedule-search-item-info {
    flex: 1;
    min-width: 0;
}

.schedule-search-item-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.schedule-search-item-username {
    font-size: 12px;
    color: var(--text-secondary);
}

.schedule-modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.schedule-modal-buttons .btn-secondary {
    width: auto;
    padding: 12px 24px;
}

.schedule-modal-buttons .btn-primary {
    width: auto;
    padding: 12px 24px;
    background: var(--orange-primary);
}

.schedule-modal-buttons .btn-primary:hover {
    background: #e67e22;
}

/* Счётчик символов */
.char-counter {
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ========== ФОРМЫ ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s;
    background: var(--bg-lighter);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--orange-primary);
    background: white;
}

.form-input[type="textarea"],
textarea.form-input {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

/* Стили для календаря даты рождения */
.form-input[type="date"] {
    color-scheme: dark;
    cursor: pointer;
    color: var(--text-primary);
}

.form-input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.6;
    cursor: pointer;
}

.form-input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.form-input:disabled,
select.form-input:disabled {
    background: var(--bg-light);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--bg-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background: var(--bg-light);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* ========== ПЕРЕКЛЮЧАТЕЛИ ========== */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.4s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background: var(--bg-gradient);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* ========== КНОПКИ ДОБАВЛЕНИЯ ========== */
.add-button {
    background: var(--bg-light);
    border: 2px dashed var(--border-color);
    color: var(--text-secondary);
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
}

.add-button:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* ========== ДЕЛЕГИРОВАНИЕ КНОПОК ========== */
.settings-item .switch {
    flex-shrink: 0;
}

/* ========== ПРОФИЛЬ ========== */
.profile-modal-content {
    max-width: 500px;
}

.profile-photo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.profile-photo-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 48px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.profile-photo-preview.clickable {
    cursor: pointer;
}

.profile-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-photo-preview:hover::after {
    content: 'Изменить';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 600;
}

.phones-list {
    margin-bottom: 12px;
}

.phone-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 8px;
}

.phone-item input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.phone-item .delete-phone-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.phone-item .delete-phone-btn:hover {
    background: rgba(231, 76, 60, 0.1);
}

.phone-item .primary-badge {
    background: var(--orange-primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

/* ========== ЭКРАН ПРОФИЛЯ ========== */
.profile-view-modal-content {
    max-width: 600px;
}

.profile-view-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.profile-view-header {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.profile-view-photo {
    flex-shrink: 0;
}

.profile-view-photo-container {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 48px;
    overflow: hidden;
}

.profile-view-photo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-view-info {
    flex: 1;
}

.profile-view-name {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.profile-view-name .profile-view-username {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.profile-view-username {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.profile-view-position {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.profile-view-spacer {
    min-height: 20px;
}

.profile-view-colleagues {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    margin-left: -4px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.profile-view-colleagues:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

.colleagues-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
}

.colleagues-icon svg {
    color: #e67e22;
    width: 32px;
    height: 32px;
}

.colleagues-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.colleagues-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.colleagues-count {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.colleagues-arrow {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.profile-view-colleagues:hover .colleagues-arrow {
    color: var(--accent-color);
}

.profile-view-status-block {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 20px;
}

.status-block-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.status-block-content {
    font-size: 16px;
    color: var(--text-primary);
    min-height: 24px;
}

.profile-view-phones {
    width: 100%;
}

.phones-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.edit-profile-button {
    width: 100%;
    padding: 14px 24px;
    background: var(--orange-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.edit-profile-button:hover {
    background: #e67e22;
}

/* ========== ДОПОЛНИТЕЛЬНАЯ ИНФОРМАЦИЯ ПРОФИЛЯ ========== */
.profile-view-additional-info {
    padding: 12px 0;
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
}

.additional-info-header {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.additional-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.additional-info-item:last-child {
    border-bottom: none;
}

.additional-info-label {
    font-size: 15px;
    color: var(--text-secondary);
}

.additional-info-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ========== ИНФОРМАЦИЯ О ЧАТЕ ========== */
.chat-info-modal-content {
    max-width: 500px;
}

.chat-info-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.chat-info-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 32px;
    flex-shrink: 0;
    overflow: hidden;
}

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

.chat-info-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 8px;
}

.chat-info-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-info-members-count {
    font-size: 14px;
    color: var(--text-secondary);
}

.chat-info-description-section {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.chat-info-description-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.chat-info-description {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 16px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.chat-info-notifications {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 12px 0;
}

.notifications-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.notifications-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notifications-status {
    font-size: 14px;
    color: var(--text-secondary);
}

.notifications-status.disabled {
    color: #ccc;
}

.chat-info-action-btn {
    margin-bottom: 12px;
    width: 100%;
    background: var(--orange-primary);
    border: none;
}

.chat-info-action-btn:hover {
    background: #e67e22;
}

.chat-info-members-section {
    margin-bottom: 20px;
}

.chat-info-members-header {
    margin-bottom: 12px;
}

.chat-info-members-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-info-members-search {
    margin-bottom: 12px;
}

.chat-members-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
}

.chat-member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 8px;
}

.chat-member-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}

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

.chat-member-info {
    flex: 1;
    min-width: 0;
}

.chat-member-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.chat-member-username {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: normal;
}

.chat-member-position {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.chat-member-role {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 8px;
    background: white;
    border-radius: 4px;
    flex-shrink: 0;
    align-self: center;
}

.chat-member-role.owner {
    color: #e67e22;
    font-weight: 600;
}

.chat-member-role.admin {
    color: #e67e22;
    font-weight: 600;
}

.chat-member-role.moderator {
    color: #3498db;
    font-weight: 600;
}

.chat-member-role.moderator {
    color: #9b59b6;
    font-weight: 600;
}

.chat-member-role.member {
    color: #95a5a6;
    font-weight: 600;
}

/* Also add classes for Russian role names to ensure compatibility */
.chat-member-role.Владелец {
    color: #e67e22;
    font-weight: 600;
}

.chat-member-role.Администратор {
    color: #e67e22;
    font-weight: 600;
}

.chat-member-role.Модератор {
    color: #9b59b6;
    font-weight: 600;
}

.chat-member-role.Участник {
    color: #333333;
    font-weight: 600;
}

.chat-member-role.Наблюдатель {
    color: #95a5a6;
    font-weight: bold;
}

/* Добавляем дополнительные стили для роли Наблюдатель */
.added-member-role.observer {
    color: #95a5a6 !important;
    font-weight: 600;
}

.added-member-role-select.observer {
    color: #95a5a6 !important;
    font-weight: 600;
    border-color: #95a5a6 !important;
}

.added-member-role-select.observer:focus {
    border-color: #95a5a6 !important;
}

/* Стили для отображения роли Наблюдатель в списке участников чата */
.chat-member-role.observer {
    color: #95a5a6 !important;
    font-weight: 600;
}

.chat-member-remove {
    display: flex;
}

.chat-info-delete-btn {
    width: 100%;
    padding: 14px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-info-delete-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.btn-danger {
    background: #e74c3c !important;
    color: white !important;
}

.btn-danger:hover {
    background: #c0392b !important;
}

.btn-warning {
    background: #f39c12 !important;
    color: white !important;
}

.btn-warning:hover {
    background: #d68910 !important;
}

.btn-danger-light {
    background: #fdf2f2 !important;
    color: #c0392b !important;
    border: 1px solid #e74c3c !important;
}

.btn-danger-light:hover {
    background: #fadbd8 !important;
}

/* Светло-красная кнопка с обводкой */
.btn-danger-outline {
    background: transparent !important;
    color: #e74c3c !important;
    border: 2px solid #e74c3c !important;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    margin-bottom: 8px;
}

.btn-danger-outline:hover {
    background: #e74c3c !important;
    color: white !important;
}

/* Маленькая кнопка корзины */
.btn-delete-small {
    background: transparent !important;
    color: #e74c3c !important;
    border: 2px solid #e74c3c !important;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 44px;
    height: 44px;
}

.btn-delete-small:hover {
    background: #e74c3c !important;
    color: white !important;
}

.chat-info-leave-btn {
    margin-bottom: 12px;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chat-info-leave-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.4);
}

/* ========== НОВЫЙ ДИЗАЙН ИНФОРМАЦИИ О ЧАТЕ ========== */

/* Кнопки действий в одну строку */
.chat-info-actions-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 20px;
}

.chat-info-action-btn-item {
    flex: 1;
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 4px;
    background: var(--bg-light);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 0;
}

.chat-info-action-btn-item:hover {
    background: var(--bg-light);
    filter: brightness(0.95);
}

.chat-info-action-btn-item:active {
    transform: scale(0.95);
}

.chat-info-action-btn-item.active {
    background: var(--bg-light);
}

.action-btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--orange-primary);
    transition: all 0.2s;
    flex-shrink: 0;
}

.action-btn-icon svg {
    width: 24px;
    height: 24px;
}

.chat-info-action-btn-item:hover .action-btn-icon {
    transform: scale(1.1);
}

.chat-info-action-btn-item.active .action-btn-icon {
    color: var(--orange-primary);
}

/* Неактивное состояние (выключенные уведомления) - серый цвет */
.chat-info-action-btn-item:not(.active):not(.leave-btn) .action-btn-icon {
    color: var(--text-secondary);
}

.chat-info-action-btn-item:not(.active):not(.leave-btn) .action-btn-text {
    color: var(--text-secondary);
}

/* Кнопка покинуть - красная */
.chat-info-action-btn-item.leave-btn .action-btn-icon {
    color: #e74c3c !important;
}

.chat-info-action-btn-item.leave-btn .action-btn-text {
    color: #e74c3c !important;
}

.chat-info-action-btn-item.leave-btn {
    background: rgba(231, 76, 60, 0.1);
}

.chat-info-action-btn-item.leave-btn:hover {
    background: rgba(231, 76, 60, 0.2);
}

.action-btn-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--orange-primary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Описание чата */
.chat-info-description-section {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.chat-info-description-section:empty,
.chat-info-description-section[style*="display: none"] {
    display: none;
}

/* Контейнер с вкладками */
.chat-info-tabs-container {
    margin-top: 8px;
}

.chat-info-tabs-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.chat-info-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-light);
    border-radius: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
}

.chat-info-tabs-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(128, 128, 128, 0.3);
    border: none;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    opacity: 0;
    pointer-events: none;
    z-index: 2;
    box-shadow: none;
    outline: none;
}

.chat-info-tabs-wrapper:hover .chat-info-tabs-arrow.scrollable {
    opacity: 1;
    pointer-events: auto;
}

.chat-info-tabs-arrow:hover {
    background: rgba(128, 128, 128, 0.5);
    color: white;
    border: none;
    box-shadow: none;
}

.chat-info-tabs-arrow-left {
    left: 4px;
}

.chat-info-tabs-arrow-right {
    right: 4px;
}

.chat-info-tabs-arrow.hidden {
    display: none;
}

.chat-info-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
    white-space: nowrap;
}

.chat-info-tab svg {
    flex-shrink: 0;
}

.chat-info-tab:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.chat-info-tab.active {
    background: var(--orange-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(230, 126, 34, 0.3);
}

/* Контент вкладок */
.chat-info-tab-content {
    min-height: 200px;
}

.chat-info-tab-pane {
    display: none;
}

.chat-info-tab-pane.active {
    display: block;
}

/* Пустое состояние для медиа */
.chat-info-media-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    text-align: center;
}

.chat-info-media-empty svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

.chat-info-media-empty p {
    font-size: 14px;
    margin: 0;
}

/* Адаптивность для маленьких экранов */
@media (max-width: 400px) {
    .chat-info-actions-row {
        gap: 4px;
        padding: 2px;
    }

    .chat-info-action-btn-item {
        padding: 6px 4px;
        gap: 4px;
    }

    .action-btn-icon {
        width: 20px;
        height: 20px;
    }

    .action-btn-icon svg {
        width: 10px;
        height: 10px;
    }

    .action-btn-text {
        font-size: 9px;
    }

    .chat-info-tabs {
        gap: 2px;
        padding: 2px;
    }

    .chat-info-tab {
        padding: 8px 4px;
        font-size: 11px;
    }

    .chat-info-tab svg {
        width: 14px;
        height: 14px;
    }
}

/* ========== СОЗДАНИЕ ЧАТА ========== */
.create-chat-modal-content {
    max-width: 550px;
}

.create-chat-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.create-chat-photo,
#chat-photo-preview,
#edit-chat-photo-preview {
    width: 80px;
    height: 80px;
    border-radius: 50% !important;
    background: var(--bg-light);
    border: 2px solid var(--orange-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden !important;
    transition: all 0.3s;
}

#chat-photo-preview img,
#edit-chat-photo-preview img,
.create-chat-photo img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
}

.create-chat-photo:hover {
    border-color: var(--orange-primary);
    color: var(--orange-primary);
}

.create-chat-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

#chat-photo-preview,
#edit-chat-photo-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
}

#chat-photo-preview img,
#edit-chat-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.create-chat-name-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.create-chat-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.create-chat-section {
    margin-bottom: 20px;
}

.char-counter {
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.create-chat-description {
    resize: vertical;
    min-height: 80px;
}

.create-chat-members-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.add-member-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--orange-primary);
    color: white;
    border: none;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.member-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.add-member-btn:hover {
    background: #e67e22;
}

.member-search-container {
    margin-bottom: 16px;
}

.members-search-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 8px;
}

.member-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.member-search-item:hover {
    background: var(--bg-light);
}

.member-search-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.member-search-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.member-search-info {
    flex: 1;
}

.member-search-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.member-search-username {
    font-size: 12px;
    color: var(--text-secondary);
}

.member-search-position {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.added-members-list {
    max-height: 300px;
    overflow-y: auto;
}

.added-member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 8px;
}

.added-member-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}

.added-member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.added-member-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.added-member-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.added-member-username {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: normal;
}

.creator-badge {
    font-size: 11px;
    font-weight: 600;
    color: white;
    background: var(--orange-primary);
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
    margin-left: auto;
}

.added-member-position {
    font-size: 12px;
    color: var(--text-secondary);
}

.added-member-role-select {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 8px;
    background: white;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    flex-shrink: 0;
}

.added-member-role-select:focus {
    outline: none;
    border: 1px solid var(--orange-primary);
}

.added-member-role-select.owner {
    color: #e67e22;
    font-weight: 600;
    border-color: #e67e22;
}

.added-member-role-select.owner:focus {
    border-color: #e67e22;
}

.added-member-role-select.admin {
    color: #e67e22;
    font-weight: 600;
    border-color: #e67e22;
}

.added-member-role-select.admin:focus {
    border-color: #e67e22;
}

.added-member-role-select.moderator {
    color: #9b59b6;
    font-weight: 600;
    border-color: #9b59b6;
}

.added-member-role-select.moderator:focus {
    border-color: #9b59b6;
}

.added-member-role-select.observer {
    color: #95a5a6;
    font-weight: 600;
    border-color: #95a5a6;
}

.added-member-role-select.observer:focus {
    border-color: #95a5a6;
}

.added-member-role.observer {
    color: #000000;
    font-weight: 600;
}

.added-member-role-select {
    font-size: 12px;
    padding: 4px 8px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-right: 8px;
    cursor: pointer;
    font-weight: 500;
}

.added-member-role-select:focus {
    outline: none;
    border: 1px solid var(--orange-primary);
}

.added-member-role-select.owner {
    color: #e67e22;
    font-weight: 600;
    border-color: #e67e22;
}

.added-member-role-select.owner:focus {
    border-color: #e67e22;
}

.added-member-role-select.admin {
    color: #e67e22;
    font-weight: 600;
    border-color: #e67e22;
}

.added-member-role-select.admin:focus {
    border-color: #e67e22;
}

.added-member-role-select.moderator {
    color: #9b59b6;
    font-weight: 600;
    border-color: #9b59b6;
}

.added-member-role-select.moderator:focus {
    border-color: #9b59b6;
}

.added-member-role-select.observer {
    color: #95a5a6;
    font-weight: 600;
    border-color: #95a5a6;
}

.added-member-role-select.observer:focus {
    border-color: #95a5a6;
}

.added-member-role-select.owner-role {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: white;
    padding-right: 12px;
    cursor: default;
}

.remove-member-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-member-btn:hover {
    background: rgba(231, 76, 60, 0.1);
}

.create-chat-btn {
    width: 100%;
    margin-top: 16px;
}

/* Старые стили для совместимости */
.chat-photo-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
    transition: all 0.3s;
}

.chat-photo-preview:hover {
    border-color: var(--orange-primary);
    color: var(--orange-primary);
}

.chat-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-photo-preview.has-image {
    border: none;
}

.members-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 8px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

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

.member-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.member-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.member-info {
    flex: 1;
}

.member-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.member-position {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========== КОЛЛЕГИ ========== */
.colleagues-modal-content {
    max-width: 600px;
}

.colleagues-search-container {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.colleagues-search-container .form-input {
    width: 100%;
    padding: 10px 14px;
}

.colleagues-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.colleagues-tab {
    flex: 1;
    padding: 14px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-secondary);
    transition: all 0.3s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.colleagues-tab.active {
    color: var(--orange-primary);
    font-weight: 600;
}

.colleagues-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--orange-primary);
}

.colleagues-tab .badge {
    background: var(--orange-primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.colleagues-list {
    max-height: 400px;
    overflow-y: auto;
}

/* ========== ЭЛЕМЕНТЫ СПИСКА КОЛЛЕГ (КОНТЕЙНЕРЫ) ========== */
.colleague-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s;
    cursor: pointer;
}

.colleague-item:hover {
    background: var(--bg-light);
    border-color: var(--orange-primary);
}

.colleague-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
    overflow: hidden;
}

.colleague-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

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

.colleague-info {
    flex: 1;
    overflow: hidden;
}

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

.colleague-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.colleague-username {
    font-size: 13px;
    color: var(--text-secondary);
}

.colleague-position {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.colleague-status {
    font-size: 14px;
    color: var(--text-secondary);
}

.colleague-item .colleague-action-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-light);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--orange-primary);
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.colleague-item .colleague-action-btn:hover {
    background: var(--orange-primary);
    color: white;
}

.colleague-add-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--orange-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.colleague-add-btn svg {
    width: 20px;
    height: 20px;
}

.colleague-add-btn:hover {
    background: #d35400;
}

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

.colleague-action-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    background: var(--bg-light);
    color: var(--orange-primary);
}

.colleague-action-btn svg {
    width: 20px;
    height: 20px;
}

.colleague-action-btn:hover {
    background: var(--orange-primary);
    color: white;
}

.accept-btn {
    background: var(--orange-primary);
    color: white;
}

.accept-btn:hover {
    background: #e67e22;
}

.reject-btn {
    background: var(--bg-light);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.reject-btn:hover {
    background: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

.cancel-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

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

.requests-section-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    padding: 12px 12px 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.colleagues-list-header {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    padding: 8px 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========== ПУБЛИЧНЫЙ ПРОФИЛЬ ========== */
.public-profile-modal-content {
    max-width: 500px;
}

.public-profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.public-profile-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 32px;
    flex-shrink: 0;
    overflow: hidden;
}

.public-profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.public-profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.public-profile-names {
    flex: 1;
}

.public-profile-names h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.public-profile-names .profile-username {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 2px;
}

.public-profile-status {
    font-size: 14px;
    color: var(--text-secondary);
}

.public-profile-info {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

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

.info-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 15px;
    color: var(--text-primary);
}

.phones-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.phone-display {
    font-size: 14px;
    color: var(--text-primary);
}

.public-profile-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.public-profile-actions .btn-primary,
.public-profile-actions .btn-secondary {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
}

.public-profile-actions .btn-primary {
    background: var(--orange-primary);
    color: white;
    border: none;
}

.public-profile-actions .btn-primary:hover {
    background: #e67e22;
}

.public-profile-actions .btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.friend-status-label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-light);
    padding: 12px 16px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    white-space: nowrap;
    text-align: center;
}

.btn-danger-icon {
    flex: 1;
    background: transparent !important;
    color: #e74c3c !important;
    border: 2px solid #e74c3c !important;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
}

.btn-danger-icon:hover {
    background: #e74c3c !important;
    color: white !important;
}

/* Маленькая кнопка удаления для профиля */
.btn-danger-icon-small {
    background: transparent !important;
    color: #e74c3c !important;
    border: 1px solid #e74c3c !important;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    box-sizing: border-box;
}

.btn-danger-icon-small:hover {
    background: #e74c3c !important;
    color: white !important;
}

.btn-danger-icon-small svg {
    width: 16px;
    height: 16px;
}

.public-profile-actions .btn-secondary:hover {
    background: var(--border-color);
}

/* ========== РЕДАКТИРОВАНИЕ СООБЩЕНИЯ ========== */
.edit-message-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.edit-message-buttons .btn-primary,
.edit-message-buttons .btn-secondary {
    flex: 1;
}

#edit-message-text {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

/* ========== ПОИСК СООБЩЕНИЙ ========== */
.search-messages-modal-content {
    max-width: 600px;
    max-height: 80vh;
}

/* ========== ПЕРЕСЫЛКА СООБЩЕНИЙ ========== */
.forward-modal-content {
    max-width: 500px;
    max-height: 80vh;
}

.forward-message-preview {
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: 10px;
    margin-bottom: 16px;
    border-left: 3px solid var(--orange-primary);
}

.forward-message-preview-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.forward-message-preview-sender {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.forward-search-container {
    margin-bottom: 12px;
}

.forward-search-container .form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

.forward-search-container .form-input:focus {
    outline: none;
    border-color: var(--orange-primary);
}

.forward-chats-list {
    max-height: 350px;
    overflow-y: auto;
}

.forward-chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    position: relative;
    z-index: 1;
    pointer-events: auto;
}

.forward-chats-list {
    position: relative;
    z-index: 1;
}

.forward-chat-item:hover {
    background: var(--bg-light);
    border-color: var(--orange-primary);
}

.forward-chat-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.forward-chat-info {
    flex: 1;
    min-width: 0;
}

.forward-chat-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.forward-chat-type {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========== ПЕРЕСЛАННЫЕ СООБЩЕНИЯ ========== */
/* Чужие сообщения - оранжевые */
.message.other .forwarded-message {
    background: var(--bg-light);
    border-left: 3px solid var(--orange-primary);
}

.message.other .forwarded-header {
    color: var(--orange-primary);
}

.message.other .forwarded-from {
    color: var(--text-primary);
}

.message.other .forwarded-label {
    color: var(--orange-primary);
}

/* Свои сообщения - полупрозрачный белый как у ответа */
.message.own .forwarded-message {
    background: rgba(255, 255, 255, 0.15);
    border-left: 3px solid rgba(255, 255, 255, 0.5);
}

.message.own .forwarded-header {
    color: rgba(255, 255, 255, 0.8);
}

.message.own .forwarded-from {
    color: rgba(255, 255, 255, 0.9);
}

.message.own .forwarded-text {
    color: rgba(255, 255, 255, 0.8);
}

.forwarded-message {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 0 8px 8px 8px;
}

.forwarded-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin-bottom: 4px;
    font-weight: 500;
}

.forwarded-header svg {
    width: 14px;
    height: 14px;
}

.forwarded-from {
    font-weight: 600;
}

.forwarded-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Контейнеры пересылок */
.forwarded-container {
    padding-left: 0;
    margin: 4px 0;
}

.forwarded-label {
    font-size: 12px;
    color: #333;
    font-weight: normal;
    padding: 4px 0;
    margin-bottom: 2px;
}

.forwarded-prefix {
    font-weight: normal;
}

.forwarded-name {
    font-weight: 700;
    color: var(--orange-primary);
    cursor: pointer;
}

.forwarded-name:hover {
    color: var(--orange-light);
}

/* Визуальные эффекты при наведении на кликабельные элементы */
.message-username {
    cursor: pointer;
}

.message-username:hover {
    color: var(--orange-primary);
}

.message-avatar {
    cursor: pointer;
}

.message-avatar:hover {
    opacity: 0.8;
}

.message.other .forwarded-name {
    color: var(--orange-primary);
}

.message.own .forwarded-name {
    color: white;
}

.forwarded-inner {
    border-left: 2px solid var(--orange-primary);
    padding-left: 8px;
    margin-left: 8px;
}

.forwarded-text {
    background: rgba(255, 107, 53, 0.1);
    border-left: 3px solid var(--orange-primary);
    padding: 8px 12px;
    border-radius: 0 8px 8px 8px;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
    margin-top: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}

.forwarded-text:hover {
    background: rgba(255, 107, 53, 0.15);
}

/* Для своих сообщений */
.message.own .forwarded-label {
    color: white;
}

.message.own .forwarded-inner {
    border-left-color: white;
}

.message.own .forwarded-text {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.message.own .forwarded-text:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Превью в модальном окне пересылки */
.forward-message-preview {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-left: 3px solid var(--orange-primary);
    padding: 12px;
    border-radius: 8px;
}

/* Контейнеры пересылок в превью */
.forwarded-container-preview {
    padding-left: 0;
    margin: 4px 0;
}

.forwarded-label-preview {
    font-size: 11px;
    color: var(--orange-primary);
    font-weight: 600;
    padding: 2px 0;
    margin-bottom: 2px;
}

.forwarded-inner-preview {
    border-left: 2px solid var(--orange-primary);
    padding-left: 8px;
    margin-left: 8px;
}

.forwarded-text-preview {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
    padding: 4px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ========== МОДАЛЬНОЕ ОКНО ПОДТВЕРЖДЕНИЯ ========== */
#confirm-modal {
    z-index: 6000 !important;
}

#confirm-modal.show {
    display: flex !important;
}

#confirm-modal .modal-content {
    z-index: 6001 !important;
}

.confirm-modal-content {
    max-width: 400px;
    text-align: center;
}

.confirm-modal-content .modal-body p {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-buttons button {
    min-width: 100px;
    padding: 10px 20px;
}

.search-messages-input-container {
    margin-bottom: 16px;
}

.search-messages-input-container .form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
}

.search-messages-input-container .form-input:focus {
    outline: none;
    border-color: var(--orange-primary);
}

.search-results-list {
    max-height: 400px;
    overflow-y: auto;
}

.search-result-message {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-message:hover {
    background: var(--bg-light);
}

.search-result-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.search-result-sender {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.search-result-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.search-result-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
}

.search-result-text mark {
    background: rgba(255, 107, 53, 0.3);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.no-search-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

/* ========== РЕЗУЛЬТАТЫ ПОИСКА ========== */
.search-results {
    background: white;
    border-bottom: 1px solid var(--border-color);
    max-height: 300px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--bg-lighter);
}

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

.search-result-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.search-result-username {
    font-size: 13px;
    color: var(--text-secondary);
}

.search-result-position {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========== БЕЙДЖ ========== */
.badge {
    background: var(--orange-primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* ========== ONLINE/OFFLINE ========== */
.online-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2ecc71;
    border: 2px solid white;
}

.offline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #95a5a6;
    border: 2px solid white;
}

/* ========== ПУСТЫЕ СОСТОЯНИЯ ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 16px;
}

/* ========== КНОПКИ ДЕЙСТВИЙ ========== */
.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.action-buttons .btn-primary,
.action-buttons .btn-secondary {
    flex: 1;
}

/* ========== КНОПКИ УДАЛЕНИЯ ========== */
.delete-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.delete-btn:hover {
    background: #c0392b;
}

/* ========== ЭЛЕМЕНТЫ СПИСКА ЧЛЕНОВ ========== */
.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s;
    cursor: pointer;
}

.member-item:hover {
    background: var(--bg-light);
    border-color: var(--orange-primary);
}

.member-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.member-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.member-info {
    flex: 1;
}

.member-name {
    font-weight: 600;
    color: var(--text-primary);
}

/* ========== ЭЛЕМЕНТЫ ПРОФИЛЯ ========== */
.phone-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.phone-input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-lighter);
}

.new-phone-input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

.new-phone-input:focus {
    outline: none;
    border-color: var(--orange-primary);
}

.primary-badge {
    background: var(--orange-primary);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.delete-phone-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.delete-phone-btn:hover {
    background: #e74c3c;
    color: white;
}

.phone-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 15px;
}

.phone-text {
    color: var(--text-primary);
}

.phone-display .primary-badge {
    background: var(--orange-primary);
    color: white;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
}

.phones-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ========== ПУБЛИЧНЫЙ ПРОФИЛЬ ========== */
.public-profile-status {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

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

.info-label {
    font-weight: 600;
    color: var(--text-secondary);
}

/* ========== ПРЕВЬЮ ФОТО ========== */
.photo-preview-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

/* ========== TOASTS (УВЕДОМЛЕНИЯ) ========== */
.toasts-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 300px;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast.success::before {
    background: #2ecc71;
}

.toast.error::before {
    background: #e74c3c;
}

.toast.info::before {
    background: #3498db;
}

.toast.warning::before {
    background: #f39c12;
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: #2ecc71;
}

.toast.error .toast-icon {
    color: #e74c3c;
}

.toast.info .toast-icon {
    color: #3498db;
}

.toast.warning .toast-icon {
    color: #f39c12;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.toast-message {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.hiding {
    animation: slideOut 0.3s ease-out forwards;
}

/* ========== ДИАЛОГ ПОДТВЕРЖДЕНИЯ ========== */
.confirm-dialog-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.7) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999 !important;
    animation: fadeIn 0.2s ease-out;
    pointer-events: auto !important;
}

.confirm-dialog {
    background: white !important;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    max-width: 400px;
    width: 90%;
    animation: scaleIn 0.2s ease-out;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 1000000 !important;
    pointer-events: auto !important;
}

.confirm-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
}

.confirm-dialog-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.confirm-dialog-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.confirm-dialog-close:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.confirm-dialog-body {
    padding: 20px 24px;
}

.confirm-dialog-message {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.confirm-dialog-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

.confirm-dialog-cancel,
.confirm-dialog-confirm {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.confirm-dialog-cancel {
    background: var(--bg-light);
    color: var(--text-primary);
}

.confirm-dialog-cancel:hover {
    background: var(--border-color);
}

.confirm-dialog-confirm {
    background: var(--orange-primary);
    color: white;
}

.confirm-dialog-confirm:hover {
    background: #e67e22;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========== ИНДИКАТОР ЗАГРУЗКИ ========== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s ease-in-out infinite;
}

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


/* ========== СЕКЦИЯ "В РАЗРАБОТКЕ" ========== */
.development-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 60px;
    text-align: center;
    width: 100%;
    max-width: 100%;
}

#development-section {
    width: 100% !important;
    max-width: 100% !important;
}

#development-section .chat-area {
    width: 100% !important;
    max-width: 100% !important;
}

.development-icon {
    color: var(--orange-primary);
    opacity: 0.3;
    margin-bottom: 24px;
}

.development-container h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-align: center;
    width: 100%;
    max-width: 900px;
}

.development-container p,
#development-description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-wrap;
    width: 100%;
    max-width: 900px;
    text-align: center;
    margin-top: 12px;
}

/* Стили для role-select в редактировании чата */
.role-select {
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

/* ========== ПРЕВЬЮ ПРИКРЕПЛЁННОГО ФАЙЛА ========== */
.media-preview-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-light);
    border-radius: 12px;
    margin-bottom: 8px;
    max-width: 100%;
}

.media-preview-container.image {
    flex-direction: column;
    align-items: flex-start;
    padding: 8px;
}

.media-preview-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: #e0e0e0;
}

.media-preview-container.image .media-preview-thumbnail {
    width: 120px;
    height: 120px;
    border-radius: 12px;
}

.media-preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.media-preview-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.media-preview-size {
    font-size: 12px;
    color: var(--text-secondary);
}

.media-preview-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.media-preview-remove:hover {
    background: rgba(255, 0, 0, 0.1);
    color: #e74c3c;
}

/* Стили для медиа в сообщениях - как в телеграм */
/* Галерея для нескольких фото */
.media-gallery {
    display: grid;
    gap: 2px;
    max-width: 100%;
}

.media-gallery img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 0;
    cursor: pointer;
}

.message-media {
    margin: 4px 0 4px 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    overflow: hidden;
    max-width: 100%;
}

.message-media.image img,
.message img {
    max-width: 400px;
    max-height: 400px;
    width: auto;
    height: auto;
    border-radius: 0 !important;
    display: block;
    cursor: pointer;
    transition: opacity 0.2s;
}

.message-media.image img:hover {
    opacity: 0.9;
}

.message-media.video video {
    max-width: 400px;
    max-height: 400px;
    width: auto;
    height: auto;
    border-radius: 12px;
    display: block;
    background: #000;
    object-fit: contain;
}

/* Лоадер загрузки */
.media-upload-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 12px;
}

.media-upload-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.media-upload-progress-bar-fill {
    height: 100%;
    background: var(--orange-primary);
    transition: width 0.3s;
}

.media-upload-progress-text {
    font-size: 12px;
    color: var(--text-secondary);
}
/* Стили для сеток медиа */
.media-grid-3 {
    margin: 0;
    padding: 0;
}

.media-grid-1 {
    max-height: 400px !important;
    max-width: 400px;
    width: 100%;
    overflow: hidden !important;
    margin: 0 auto;
}

.media-grid-1 img,
.media-grid-1 video {
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    border-radius: 0 !important;
}

[class*="media-grid-"]:not(.media-grid-1) img,
[class*="media-grid-"]:not(.media-grid-1) video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: 0 !important;
    max-width: none !important;
    max-height: none !important;
}

/* Videos in grids */
[class*="media-grid-"] video {
    object-fit: contain !important;
    background: #000 !important;
    width: 100% !important;
    height: auto !important;
    max-height: 400px !important;
}

/* Message container - remove all padding */
.message:has([class*="media-grid-"]) {
    padding: 0 !important;
    background: transparent !important;
}

/* Own messages */
.message.own:has([class*="media-grid-"]) {
    background: var(--purple-primary) !important;
    border-radius: 18px 18px 4px 18px !important;
    overflow: hidden !important;
}

/* Other messages */
.message.other:has([class*="media-grid-"]) {
    background: white !important;
    border-radius: 18px 18px 18px 4px !important;
    overflow: hidden !important;
}

/* Media grids */
[class*="media-grid-"] {
    border-radius: 0 !important;
    overflow: hidden;
}

/* Text padding */
.message:has([class*="media-grid-"]) .message-header {
    padding: 4px 12px 0 12px !important;
}

.message:has([class*="media-grid-"]) .message-footer {
    padding: 4px 12px 8px 12px !important;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* Кастомный аудио виджет */
.audio-widget-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: transparent;
    max-width: 260px;
    max-width: 320px;
}

.audio-play-btn {
    width: 40px;
    height: 40px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--orange-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s, background 0.2s;
}

.audio-play-btn:hover {
    transform: scale(1.1);
    background: #e67e22;
}

.message.own .audio-play-btn {
    background: rgba(255, 255, 255, 0.9);
    color: var(--purple-primary);
}

.audio-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    gap: 6px;
}

.audio-name {
    font-size: 13px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message.own .audio-name {
    color: rgba(255, 255, 255, 0.95);
}

.audio-progress {
    position: relative;
    height: 4px;
    height: 6px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
    border-radius: 3px;
    cursor: pointer;
    min-width: 100px;
    min-width: 140px;
}

.message.own .audio-progress {
    background: rgba(255, 255, 255, 0.25);
}

.audio-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: var(--orange-primary);
    border-radius: 2px;
    border-radius: 3px;
    transition: width 0.1s linear;
}

.message.own .audio-progress-fill {
    background: rgba(255, 255, 255, 0.9);
}

.audio-duration {
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.message.own .audio-duration {
    color: rgba(255, 255, 255, 0.7);
}
/* ========== ПОЛОСКА ДЛЯ ПЕРЕСЛАННЫХ МЕДИА-СООБЩЕНИЙ ========== */
.message:has([class*="media-grid-"]) .forwarded-container {
    padding: 0 12px;
}

.message:has([class*="media-grid-"]) .forwarded-label {
    padding: 8px 0 4px 0;
}

.message:has([class*="media-grid-"]) .forwarded-inner {
    border-left: 2px solid var(--orange-primary) !important;
    padding-left: 8px !important;
}

.message.own:has([class*="media-grid-"]) .forwarded-inner {
    border-left-color: white !important;
}
/* ========== СКРЫТИЕ СКРОЛЛБАРОВ В МОДАЛЬНОМ ОКНЕ ИНФОРМАЦИИ О ЧАТЕ ========== */
.chat-info-tabs::-webkit-scrollbar,
.chat-members-list::-webkit-scrollbar,
.chat-info-actions-row::-webkit-scrollbar {
    display: none; /* Скрыть скроллбар */
}

.chat-info-tabs,
.chat-members-list,
.chat-info-actions-row {
    -ms-overflow-style: none;  /* IE и Edge */
    scrollbar-width: none;  /* Firefox */
}
/* ========== ЗАГОЛОВОК УЧАСТНИКОВ В ИНФОРМАЦИИ О ЧАТЕ ========== */
.chat-info-members-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.members-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.members-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--orange-primary);
    flex-shrink: 0;
}

.members-header-icon svg {
    width: 20px;
    height: 20px;
}

.members-header-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.members-header-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--orange-primary);
    margin-left: 4px;
}

.members-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-button {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.icon-button:hover {
    background: none;
    color: var(--orange-primary);
}

.icon-button.active {
    background: var(--bg-light);
    color: var(--orange-primary);
}

.chat-info-members-search.hidden {
    display: none;
}

.chat-info-members-search {
    margin-bottom: 12px;
}

.chat-info-members-search .form-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-lighter);
}

.chat-info-members-search .form-input:focus {
    outline: none;
    border-color: var(--orange-primary);
}

/* Кликабельные участники */
.chat-member-item.clickable {
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.chat-member-item.clickable:hover {
    background: var(--bg-light);
    transform: translateX(4px);
}

.chat-member-item.clickable:active {
    transform: translateX(2px);
}
/* ========== ПОИСК УЧАСТНИКОВ В ИНФОРМАЦИИ О ЧАТЕ ========== */
.chat-info-members-header {
    position: relative;
}
.chat-info-members-search {
    position: absolute;
    top: 0;
    right: 40px;
    width: 200px;
    margin-bottom: 0;
    z-index: 10;
}
.chat-info-members-search .form-input {
    border-radius: 20px !important;
    padding: 10px 16px;
}
/* Улучшенный вид поиска участников */
.chat-info-members-search .form-input {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 2px solid var(--orange-primary);
}
/* ========== МЕДИА В ИНФОРМАЦИИ О ЧАТЕ ========== */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    padding: 16px;
}

.media-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1;
    background: var(--bg-light);
    transition: transform 0.2s, box-shadow 0.2s;
}

.media-item.audio-media-item {
    aspect-ratio: auto;
    height: auto;
    grid-column: 1 / -1;
    background: transparent;
    border: none;
    cursor: default;
}

.media-item.audio-media-item:hover {
    transform: none;
    box-shadow: none;
}

.media-item.audio-media-item .audio-widget-small {
    width: 100%;
    height: auto;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: white;
}

.media-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.4), transparent);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.media-item:hover .media-overlay {
    opacity: 1;
}

.video-thumbnail {
    position: relative;
    width: 100%;
    height: 100%;
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-thumbnail-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    color: var(--text-tertiary);
}

.audio-widget-small {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    width: 100%;
    height: 100%;
}

.audio-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--orange-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.audio-info {
    flex: 1;
    min-width: 0;
}

.audio-title {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-duration {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.audio-widget-small.playing {
    border-color: var(--orange-primary);
    background: rgba(255, 107, 0, 0.05);
}

.audio-play-btn.playing {
    background: var(--orange-dark);
}

.loading-media,
.empty-media-state,
.error-media-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.loading-media svg,
.empty-media-state svg,
.error-media-state svg {
    margin-bottom: 16px;
    color: var(--text-tertiary);
}

.loading-media p,
.empty-media-state p,
.error-media-state p {
    margin: 0;
    font-size: 14px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-media svg {
    animation: spin 1s linear infinite;
}
/* ========== ГРАФИКИ РАБОТЫ ========== */
.schedule-table-container {
    background: linear-gradient(135deg, #FF6B35 0%, #8B4CBF 100%);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
    overflow: visible;
    padding: 2px;
}

.schedule-header {
    background: linear-gradient(135deg, #FF6B35 0%, #8B4CBF 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-radius: 12px 12px 0 0;
    margin: 0;
}

.schedule-table-wrapper {
    background: white;
    border-radius: 0 0 12px 12px;
    overflow-x: visible;
    padding: 0;
    margin: 0;
    width: 100%;
    margin-top: -1px;
    position: relative;
}

.schedule-table-wrapper.collapsed {
    display: none;
}

.schedule-title-section {
    flex: 1;
    min-width: 300px;
}

.schedule-title {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.schedule-code {
    font-size: 14px;
    font-weight: 400;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 20px;
    font-family: monospace;
    letter-spacing: 1px;
}

.schedule-month-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    padding: 8px 16px;
}

.month-nav-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.month-nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.month-year-display {
    font-size: 18px;
    font-weight: 600;
    min-width: 140px;
    text-align: center;
}

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

.schedule-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.schedule-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.schedule-action-btn.hide-btn:hover {
    background: rgba(239, 68, 68, 0.5);
}

.schedule-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1200px;
    font-size: 13px;
    border-top: none;
    margin-top: 0;
}

.schedule-table thead {
    background: var(--bg-lighter);
    border-bottom: 2px solid #c25a7a;
    border-top: none;
    margin: 0;
    padding: 0;
}

.schedule-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    border-right: 1px solid #c25a7a;
    border-bottom: 2px solid #c25a7a;
    vertical-align: middle;
    position: relative;
    margin: 0;
}

.schedule-table thead tr:first-child th {
    padding-top: 12px;
}

.schedule-table .days-row th {
    padding: 10px 8px;
    vertical-align: middle;
}

.schedule-table th:last-child {
    border-right: none;
}

.schedule-table th.group-header,
.schedule-table th.user-header {
    background: var(--bg-light);
    text-align: left;
    padding-left: 16px;
    min-width: 180px;
}

.schedule-table th.day-header {
    min-width: 36px;
    padding: 8px 4px;
    border-right: 1px solid #c25a7a;
}

.schedule-table th.total-header {
    min-width: 80px;
    background: var(--bg-light);
    font-weight: 700;
    color: var(--orange-primary);
    border-left: 2px solid #c25a7a;
}

.schedule-table tbody tr {
    transition: none;
}

/* Сначала убедимся, что у ячеек с именем есть фон */
.schedule-table td.user-cell {
    background-color: white !important; /* или цвет фона как у других ячеек */
}

.schedule-table tbody tr:hover td.shift-cell,
.schedule-table tbody tr:hover td.user-cell {
    filter: brightness(0.92) sepia(0.15) saturate(1.2);
    transition: filter 0.2s ease;
}

.schedule-table tbody tr:hover td.shift-empty {
    background-color: rgba(255, 107, 53, 0.12) !important;
}

.schedule-table tbody tr.group-start-row td {
    border-top: 3px solid #c25a7a;
}

.schedule-table-wrapper {
    position: relative;
}

.schedule-table td {
    padding: 6px 8px;
    text-align: center;
    border-right: 1px solid #1a1a1a;
    border-bottom: 1px solid #1a1a1a;
    vertical-align: middle;
}

.schedule-table tbody tr:last-child td {
    border-bottom: none !important;
}

.schedule-table td:last-child {
    border-right: none;
}

.schedule-table td.shift-cell {
    border-right: 1px solid #1a1a1a;
}

/* Выделение сегодняшнего столбца */
.schedule-table th.today {
    background: rgba(255, 107, 53, 0.15) !important;
    color: var(--orange-primary);
    font-weight: 700;
}

.schedule-table td.today {
    position: relative;
}

.schedule-table td.today::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 107, 53, 0.25);
    pointer-events: none;
}

.schedule-table td.group-cell {
    text-align: center !important;
    padding: 4px !important;
    font-weight: 600;
    color: var(--text-primary) !important;
    background: var(--bg-lighter) !important;
    border-right: 2px solid #c25a7a !important;
    vertical-align: middle !important;
    width: 10px !important;
    min-width: 10px !important;
    max-width: 10px !important;
}

.schedule-table td.group-cell span {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transform: rotate(-90deg);
    transform-origin: center center;
    white-space: normal;
    font-size: 14px;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    max-width: 150px;
    text-align: center;
    line-height: 1.2;
}

.schedule-table td.user-cell {
    text-align: left;
    padding: 5px 12px;
}

.schedule-table td.user-cell .user-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--orange-primary);
    cursor: pointer;
    transition: opacity 0.2s;
}

.schedule-table td.user-cell .user-name:hover {
    opacity: 0.8;
}

.schedule-table td.user-cell .user-position {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
}

/* Пустое состояние */
.no-schedules-message {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.no-schedules-message h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.no-schedules-message p {
    font-size: 15px;
    max-width: 500px;
    margin: 0 auto 24px;
    line-height: 1.5;
}

/* Адаптивность */
.schedules-container {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    max-width: 100%;
    margin-bottom: 24px;
}
@media (max-width: 768px) {
    .schedule-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .schedule-title-section {
        min-width: auto;
    }
    
    .schedule-month-nav {
        justify-content: center;
    }
    
    .schedule-actions {
        justify-content: center;
    }
    
    .schedule-table-wrapper {
        margin: 0 -16px;
        padding: 0 16px;
    }
}
/* Ensure the entire schedule section is horizontally scrollable */
#development-section,
.schedules-container,
.schedule-table-container,
.schedule-table-wrapper {
    overflow-x: auto !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* График в режиме редактирования смен */
.schedule-table-container.editing-shifts {
    padding: 3px;
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.3);
}

.schedule-table-container.editing-shifts .schedule-header {
    border-radius: 9px 9px 0 0;
}

/* Кнопки Сохранить и Отменить в режиме редактирования смен */
.schedule-action-btn.save-btn {
    background: var(--orange-primary);
    color: white;
    padding: 10px 32px;
    border-radius: 8px;
    width: auto !important;
    height: auto !important;
    min-width: 120px;
}

.schedule-action-btn.save-btn:hover {
    background: #e55a2b;
}

.schedule-action-btn.cancel-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 32px;
    border-radius: 8px;
    width: auto !important;
    height: auto !important;
    min-width: 120px;
}

.schedule-action-btn.cancel-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.schedule-action-btn.save-btn span,
.schedule-action-btn.cancel-btn span {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}
/* User requested adjustments */
.schedule-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.schedule-collapse-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.schedule-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.schedule-code {
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    overflow: visible !important;
    max-width: none !important;
    text-overflow: unset !important;
    padding: 2px 8px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border-radius: 12px !important;
}

.schedule-code .copy-code-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 2px;
    width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s, opacity 0.2s;
    opacity: 0.7;
    vertical-align: middle;
    margin-left: 4px;
}

.schedule-code .copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
}

.schedule-code .copy-code-btn svg {
    display: block;
}

.month-year-display {
    text-align: center !important;
    flex: 1 !important;
    order: 2 !important;
    margin: 0 auto !important;
}

.schedule-month-nav {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 20px !important;
}

.schedule-month-nav .month-nav-btn:first-child {
    order: 1 !important;
}

.schedule-month-nav .month-nav-btn:last-child {
    order: 3 !important;
}
/* Принудительные стили для всех графиков (существующих и новых) */
.schedule-title h2 {
    font-size: 14px !important;
    font-weight: 600 !important;
    margin: 0 !important;
    display: inline-block !important;
}

.schedule-code {
    white-space: nowrap !important;
    display: inline-block !important;
    overflow: visible !important;
    max-width: none !important;
    text-overflow: unset !important;
    padding: 2px 8px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border-radius: 12px !important;
    margin-left: 8px !important;
}

.schedule-month-nav {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 20px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border-radius: 30px !important;
    padding: 8px 16px !important;
    margin: 0 auto !important;
}

.schedule-month-nav .current-month {
    text-align: center !important;
    flex: 1 !important;
    order: 2 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    min-width: 140px !important;
}

.schedule-month-nav .month-nav-btn:first-child {
    order: 1 !important;
}

.schedule-month-nav .month-nav-btn:last-child {
    order: 3 !important;
}

/* Горизонтальная прокрутка для всех контейнеров графиков */
#development-section,
.schedules-container,
.schedule-table-container,
.schedule-table-wrapper {
    overflow-x: auto !important;
    width: 100% !important;
    max-width: 100% !important;
}
/* Уменьшение вертикального пробела между верхней панелью и днями месяца */
.schedule-table thead {
    border-bottom: 2px solid #c25a7a;
}

.schedule-table th.day-header {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
}

.schedule-table th {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

/* ========== РУЧНОЙ УЧАСТНИК В ГРАФИКАХ ========== */
/* Кнопка карандаша рядом с кнопкой "+" */
.add-manual-member-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--orange-primary);
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 4px;
}

.add-manual-member-btn svg {
    width: 14px;
    height: 14px;
}

.add-manual-member-btn:hover {
    background: #e67e22;
    transform: scale(1.05);
}

/* Контейнер ручного участника */
.manual-member {
    background: #e9ecef;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.manual-member:hover {
    background: #e9ecef;
}

.manual-member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 20px;
    flex-shrink: 0;
}

.manual-member-avatar svg {
    width: 20px;
    height: 20px;
}

.manual-member-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.manual-member-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    transition: border-color 0.2s;
}

.manual-member-input:focus {
    outline: none;
    border-color: #36B37E;
}

.manual-member-input::placeholder {
    color: #adb5bd;
}

.manual-member-remove {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.manual-member-remove:hover {
    background: rgba(231, 76, 60, 0.1);
}

/* Индикатор ручного участника в таблице */
.schedule-table td.user-cell .manual-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #36B37E;
    background: rgba(54, 179, 126, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

.schedule-table td.user-cell .manual-indicator svg {
    width: 10px;
    height: 10px;
}

/* Отключение клика по ручному участнику */
.schedule-table td.user-cell .user-name.manual {
    cursor: default;
    color: #6c757d;
}

.schedule-table td.user-cell .user-name.manual:hover {
    opacity: 1;
}

/* Панель выбора смены */
.shift-selector-panel {
    background: white;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

.shift-selector-panel .shift-options-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.shift-options-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}

.shift-options-divider {
    width: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

.shift-selector-panel .shift-option.shift-clear {
    border-top: 1px solid #eee;
    margin-top: 4px;
    padding-top: 12px;
}

.shift-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.shift-option:hover {
    background: #f0f0f0;
}

.shift-option .shift-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.shift-option .shift-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 12px;
}

.shift-option.shift-1 .shift-marker {
    background: #FFA500;
}

.shift-option.shift-2 .shift-marker {
    background: #729fcf;
}

.shift-option.shift-3 .shift-marker {
    background: #bf819e;
}

.shift-option.shift-12 .shift-marker {
    background: #50938a;
}

.shift-option.shift-v .shift-marker {
    background: #cccccc;
}

.shift-option.shift-b .shift-marker {
    background: #ff4000;
}

.shift-option.shift-ot .shift-marker {
    background: #FFCF40;
}

.shift-option.shift-k .shift-marker {
    background: #2a6099;
}

.shift-option.shift-p .shift-marker {
    background: #2a6099;
}

.shift-option.shift-o .shift-marker {
    background: #cccccc;
}

.shift-option.shift-clear {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
    margin-top: 4px;
    padding-top: 8px;
}

.shift-option.shift-clear .shift-icon {
    display: flex;
    align-items: center;
    color: #dc3545;
}

.shift-option.shift-clear .shift-label {
    color: #dc3545;
}

.shift-option.shift-templates {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    justify-content: flex-start;
}

.shift-option.shift-templates .shift-icon {
    display: flex;
    align-items: center;
    color: #666;
}

.shift-option.shift-templates .shift-label {
    color: #666;
}

.shift-option.shift-templates:hover {
    background: #f5f5f5;
}

/* Панель шаблонов */
.templates-panel {
    position: fixed;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
    z-index: 10001;
}

.template-option {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.template-option:hover {
    background: #f5f5f5;
}

.template-option .template-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.template-option .template-desc {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

/* Ячейки смен */
.schedule-table td.shift-cell {
    cursor: default;
    font-weight: 700 !important;
}

.schedule-table-container.editing-shifts .shift-cell {
    cursor: pointer;
}

.schedule-table td.shift-1 {
    background: #FFA500 !important;
    color: white !important;
    font-weight: 600;
}

.schedule-table td.shift-2 {
    background: #729fcf !important;
    color: white !important;
    font-weight: 600;
}

.schedule-table td.shift-3 {
    background: #bf819e !important;
    color: white !important;
    font-weight: 600;
}

.schedule-table td.shift-12 {
    background: #50938a !important;
    color: white !important;
    font-weight: 600;
}

.schedule-table td.shift-v {
    background: #cccccc !important;
    color: white !important;
    font-weight: 600;
}

.schedule-table td.shift-b {
    background: #ff4000 !important;
    color: white !important;
    font-weight: 600;
}

.schedule-table td.shift-ot {
    background: #FFCF40 !important;
    color: white !important;
    font-weight: 600;
}

.schedule-table td.shift-k {
    background: #2a6099 !important;
    color: white !important;
    font-weight: 600;
}

.schedule-table td.shift-p {
    background: #2a6099 !important;
    color: white !important;
    font-weight: 600;
}

.schedule-table td.shift-o {
    background: #cccccc !important;
    color: white !important;
    font-weight: 600;
}

.schedule-table td.shift-empty {
    background: #f8f9fa;
    color: #adb5bd;
}

/* Выделение редактируемой ячейки */
.schedule-table td.shift-cell.editing {
    outline: 3px solid var(--orange-primary);
    outline-offset: -3px;
}

/* Выделение множества ячеек */
.schedule-table td.shift-cell.selected {
    outline: none;
    background: rgba(255, 107, 53, 0.3) !important;
    border: none !important;
}

.schedule-table td.shift-cell.selected.shift-1,
.schedule-table td.shift-cell.selected.shift-2,
.schedule-table td.shift-cell.selected.shift-3,
.schedule-table td.shift-cell.selected.shift-12,
.schedule-table td.shift-cell.selected.shift-v,
.schedule-table td.shift-cell.selected.shift-b,
.schedule-table td.shift-cell.selected.shift-ot,
.schedule-table td.shift-cell.selected.shift-k,
.schedule-table td.shift-cell.selected.shift-p,
.schedule-table td.shift-cell.selected.shift-o {
    outline: none;
    border: none !important;
}

/* Градиентный фон для шапки таблицы */
.schedule-table thead {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.75) 0%, rgba(139, 76, 191, 0.75) 100%) !important;
    border-bottom: 2px solid #c25a7a;
    position: relative;
    z-index: 1;
}

.schedule-table thead::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    pointer-events: none;
    z-index: -1;
}

.schedule-table th {
    background: transparent !important;
    color: white !important;
}

/* Текст в группе тоже белым */
.schedule-table td.group-cell span {
    color: var(--orange-primary) !important;
}

/* Сплошной фон для колонки Часы */
.schedule-table td.total-hours {
    background: rgba(139, 76, 191, 0.75) !important;
    color: white !important;
    font-weight: 700;
}