/* WinClass App - Professional Styles */

:root {
    /* Основные цвета WinClass */
    --lime: #4DC247;
    --lime-bright: #7CFC00;
    --cyan: #41C8E5;
    --purple: #9B59B6;
    --pink: #E91E8C;
    
    /* Градиенты */
    --gradient-primary: linear-gradient(135deg, var(--lime) 0%, var(--cyan) 100%);
    --gradient-button: linear-gradient(135deg, var(--lime-bright) 0%, var(--lime) 50%, var(--cyan) 100%);
    --gradient-accent: linear-gradient(135deg, var(--cyan) 0%, var(--purple) 100%);
    
    /* Нейтральные */
    --white: #FFFFFF;
    --bg: #F0F4F8;
    --bg-card: #FFFFFF;
    --text-primary: #1A1A2E;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --border: #E5E7EB;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
    
    /* Размеры */
    --radius: 16px;
    --radius-sm: 12px;
    --radius-full: 50px;
    --nav-height: 70px;
    --header-height: 60px;
    
    /* Safe areas */
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
}

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

html, body {
    height: 100%;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

#app {
    height: 100%;
    position: relative;
}

/* ========== ЭКРАНЫ ========== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    background: var(--bg);
    overflow: hidden;
}

.screen.active {
    display: flex;
}

/* ========== ДЕКОРАТИВНЫЕ ЭЛЕМЕНТЫ ========== */
.decor-circle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.decor-1 {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, rgba(77, 194, 71, 0.3) 0%, rgba(65, 200, 229, 0.2) 100%);
    top: -50px;
    right: -50px;
    filter: blur(40px);
}

.decor-2 {
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, rgba(65, 200, 229, 0.3) 0%, rgba(155, 89, 182, 0.2) 100%);
    bottom: 150px;
    left: -50px;
    filter: blur(30px);
}

.decor-3 {
    width: 100px;
    height: 100px;
    background: rgba(155, 89, 182, 0.2);
    top: 30%;
    right: -30px;
    filter: blur(25px);
}

.decor-4 {
    width: 80px;
    height: 80px;
    background: rgba(77, 194, 71, 0.25);
    bottom: 25%;
    left: 10%;
    filter: blur(20px);
}

/* ========== ЭКРАН УСТАНОВКИ ========== */
#install-screen {
    background: var(--white);
    padding-bottom: var(--nav-height);
}

.install-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 24px 24px;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

.install-logo {
    width: 100px;
    height: 100px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.install-logo img,
.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(77, 194, 71, 0.3));
}

.install-title {
    font-size: 32px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.install-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* Карточка установки */
.install-card {
    width: 100%;
    max-width: 340px;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}

.install-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.install-card-header .install-icon {
    width: 28px;
    height: 28px;
    color: var(--lime);
}

.install-benefits {
    list-style: none;
}

.install-benefits li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.install-benefits li:last-child {
    border-bottom: none;
}

.install-benefits svg {
    width: 20px;
    height: 20px;
    color: var(--cyan);
    flex-shrink: 0;
}

/* Инструкции */
.install-instruction {
    width: 100%;
    max-width: 340px;
    margin-bottom: 24px;
}

.instruction-step {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.instruction-step:last-child {
    border-bottom: none;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--white);
    font-size: 14px;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content p {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.step-content strong {
    color: var(--lime);
    font-weight: 600;
}

.step-icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.step-icon-box svg {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
}

/* Кнопка "Готово" */
.btn-install-done {
    width: 100%;
    max-width: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 32px;
    background: var(--gradient-button);
    border: none;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    color: var(--white);
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(77, 194, 71, 0.4);
    transition: all 0.3s ease;
}

.btn-install-done:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(77, 194, 71, 0.5);
}

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

.btn-install-done svg {
    width: 20px;
    height: 20px;
}

/* Главная кнопка установки (Android) */
.btn-install-main {
    width: 100%;
    max-width: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 32px;
    background: var(--gradient-button);
    border: none;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(77, 194, 71, 0.4);
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.btn-install-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(77, 194, 71, 0.5);
}

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

.btn-install-main svg {
    width: 24px;
    height: 24px;
}

/* Компактная инструкция iOS */
.ios-instruction-compact {
    width: 100%;
    max-width: 340px;
    display: none;
}

.ios-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.ios-hint svg {
    width: 32px;
    height: 32px;
    color: var(--cyan);
    flex-shrink: 0;
}

.ios-hint strong {
    color: var(--lime);
}

.ios-instruction-compact .btn-install-done {
    margin-top: 0;
}

/* ========== НИЖНЯЯ НАВИГАЦИЯ ========== */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    padding-bottom: var(--safe-bottom);
    background: var(--white);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.nav-item.active {
    color: var(--lime);
}

.nav-item:hover {
    color: var(--cyan);
}

.nav-icon {
    width: 24px;
    height: 24px;
}

.nav-label {
    font-size: 11px;
    font-weight: 600;
}

/* ========== ЗАГОЛОВКИ ========== */
.screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 16px;
    padding-top: var(--safe-top);
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.screen-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    border-radius: 50%;
    transition: background 0.2s;
}

.back-btn:hover {
    background: var(--bg);
}

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

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 16px;
    padding-top: var(--safe-top);
    background: var(--white);
    box-shadow: var(--shadow);
}

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

.header-logo img {
    width: 36px;
    height: 36px;
}

.header-logo span {
    font-size: 20px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

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

.header-btn svg {
    width: 22px;
    height: 22px;
}

/* ========== ФОРМЫ ========== */
.form-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 24px;
    overflow-y: auto;
}

.form-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 32px;
}

.form-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-form {
    width: 100%;
    max-width: 340px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg);
 background: var(--white);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--lime);
    background: var(--white);
}

.password-input {
    position: relative;
}

.password-input input {
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
}

.toggle-password svg {
    width: 20px;
    height: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 20px;
}

.checkbox-label input {
    display: none;
}

.checkmark {
    width: 22px;
    height: 22px;
    background: var(--white);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.checkbox-label input:checked + .checkmark {
    background: var(--lime);
    border-color: var(--lime);
}

.checkbox-label input:checked + .checkmark::after {
    content: '✓';
    color: var(--white);
    font-size: 14px;
    font-weight: bold;
}

.form-error {
    color: #EF4444;
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 8px;
}

/* ========== КНОПКИ ========== */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--gradient-button);
    border: none;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    color: var(--white);
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(77, 194, 71, 0.35);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(77, 194, 71, 0.45);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    background: var(--bg);
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    margin-bottom: 12px;
    transition: all 0.2s;
}

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

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

.btn-danger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    background: #FEE2E2;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #DC2626;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #FECACA;
}

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

/* ========== ЧАТЫ ========== */
.chats-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    padding-bottom: calc(var(--nav-height) + 20px);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.section-title svg {
    width: 20px;
    height: 20px;
    color: var(--cyan);
}

.badge {
    background: var(--lime);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.badge:empty,
.badge[data-count="0"] {
    display: none;
}

.chats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
}

.chat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.chat-item.has-unread {
    border-left: 3px solid var(--lime);
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-avatar svg {
    width: 24px;
    height: 24px;
    color: var(--white);
}

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

.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);
}

.chat-item-time {
    font-size: 12px;
    color: var(--text-muted);
}

.chat-client-info {
    font-size: 12px;
    color: var(--lime);
    margin-bottom: 2px;
}

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

.chat-item-badge {
    background: var(--lime);
    color: var(--white);
    font-size: 12px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chats-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
}

.chats-empty.hidden {
    display: none;
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.empty-icon svg {
    width: 36px;
    height: 36px;
    color: var(--text-muted);
}

.chats-empty p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.chats-empty .btn-primary {
    width: auto;
    padding: 14px 32px;
}

/* ========== ЭКРАН ЧАТА ========== */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--header-height);
    padding: 0 12px;
    padding-top: var(--safe-top);
    background: var(--white);
    box-shadow: var(--shadow);
}

.chat-info {
    flex: 1;
}

.chat-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
}

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

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100%;
    justify-content: flex-end;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 20px;
    position: relative;
    animation: messageIn 0.3s ease;
}

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

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

.message.other {
    align-self: flex-start;
    background: var(--white);
    box-shadow: var(--shadow);
    border-bottom-left-radius: 6px;
}

.message.admin {
    background: var(--gradient-accent);
    color: var(--white);
}

.message-sender {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.85;
}

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

.message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 6px;
    text-align: right;
}

/* Ввод сообщения */
.message-input-container {
    padding: 12px 16px;
    padding-bottom: calc(12px + var(--safe-bottom));
    background: var(--white);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}

.message-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg);
    border-radius: var(--radius-full);
    padding: 6px 6px 6px 20px;
}

#message-input {
    flex: 1;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 15px;
    resize: none;
    max-height: 100px;
    padding: 10px 0;
    color: var(--text-primary);
}

#message-input:focus {
    outline: none;
}

#message-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--gradient-button);
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(77, 194, 71, 0.3);
}

.send-btn:disabled {
    background: var(--border);
    box-shadow: none;
    cursor: not-allowed;
}

.send-btn:not(:disabled):hover {
    transform: scale(1.05);
}

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

/* ========== НАСТРОЙКИ ========== */
.settings-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
}

.settings-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.settings-card h3 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.setting-row:last-of-type {
    border-bottom: none;
}

.setting-row span {
    font-size: 15px;
    color: var(--text-primary);
}

/* Toggle switch */
.toggle {
    position: relative;
    width: 52px;
    height: 28px;
    cursor: pointer;
}

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

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

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: var(--white);
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.toggle input:checked + .toggle-slider {
    background: var(--lime);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.user-info {
    padding: 16px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.user-info .user-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.user-info .user-role {
    font-size: 14px;
    color: var(--text-secondary);
}

.app-version {
    font-size: 14px;
    color: var(--text-muted);
}

/* ========== POPUP ========== */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.popup-overlay.active {
    display: flex;
}

.popup-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    max-width: 320px;
    width: 100%;
    animation: popupIn 0.3s ease;
}

@keyframes popupIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.popup-icon {
    width: 64px;
    height: 64px;
    background: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.popup-icon svg {
    width: 32px;
    height: 32px;
    color: var(--cyan);
}

.popup-content h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.popup-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.popup-content .btn-primary {
    max-width: 200px;
    margin: 0 auto;
}

/* ========== СКРОЛЛБАР ========== */
::-webkit-scrollbar {
    width: 0;
    background: transparent;
}






/* ============================================
   PUSH POPUP СТИЛИ - добавить в конец app.css
   ============================================ */

.push-popup-content {
    max-width: 300px;
}

.push-icon {
    background: linear-gradient(135deg, var(--lime) 0%, var(--cyan) 100%);
}

.push-icon svg {
    color: var(--white);
}

.popup-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.popup-buttons .btn-primary {
    padding: 14px;
}

.btn-secondary-small {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    padding: 10px;
}

.btn-secondary-small:hover {
    color: var(--text-secondary);
}





/* ========================================
   ДОБАВИТЬ В КОНЕЦ app.css
   ======================================== */

/* Блок "Приложение уже установлено" */
.already-installed {
    width: 100%;
    max-width: 340px;
    text-align: center;
    padding: 24px;
    background: rgba(77, 194, 71, 0.1);
    border-radius: 16px;
    border: 2px solid var(--lime);
}

.already-installed-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--lime);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.already-installed-icon svg {
    width: 36px;
    height: 36px;
    color: white;
}

.already-installed-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--lime);
    margin-bottom: 8px;
}

.already-installed-hint {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}







/* Кнопка на полную ширину */
.btn-full {
    width: 100%;
    margin-top: 8px;
}

/* Push popup без кнопки "Позже" */
.push-popup-content {
    text-align: center;
}

.push-popup-content h3 {
    margin-bottom: 8px;
}

.push-popup-content p {
    margin-bottom: 20px;
    color: var(--text-secondary);
}






/* ==================== */
/* КАНАЛ НОВОСТЕЙ       */
/* ==================== */

.chat-channel {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(167, 139, 250, 0.05) 100%);
    border-left: 3px solid #8B5CF6;
}

.chat-channel.has-unread {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(167, 139, 250, 0.1) 100%);
}

.channel-avatar {
    background: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 100%) !important;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.channel-avatar svg {
    stroke: white !important;
}





/* ==================== */
/* РЕАКЦИИ              */
/* ==================== */

.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
    position: relative;
}

.reaction-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #E2E8F0;
    border-radius: 20px;
    background: #F7FAFC;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.reaction-btn:hover {
    background: #EDF2F7;
    border-color: #CBD5E0;
}

.reaction-btn.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(167, 139, 250, 0.1) 100%);
    border-color: #8B5CF6;
}

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

.reaction-count {
    font-size: 12px;
    font-weight: 600;
    color: #4A5568;
}

.reaction-btn.active .reaction-count {
    color: #8B5CF6;
}

.reaction-add-btn {
    width: 28px;
    height: 28px;
    border: 1px dashed #CBD5E0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #A0AEC0;
    font-size: 16px;
    transition: all 0.2s ease;
}

.reaction-add-btn:hover {
    border-color: #8B5CF6;
    color: #8B5CF6;
    background: rgba(139, 92, 246, 0.05);
}

.reaction-picker {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    background: white;
    border-radius: 24px;
    padding: 6px 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    gap: 4px;
    margin-bottom: 8px;
    z-index: 100;
}

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

.reaction-picker-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reaction-picker-btn:hover {
    background: #F7FAFC;
    transform: scale(1.2);
}

.reaction-picker-btn.active {
    background: rgba(139, 92, 246, 0.15);
}

/* Реакции в своих сообщениях — справа */
.message.own .message-reactions {
    justify-content: flex-end;
}

.message.own .reaction-picker {
    left: auto;
    right: 0;
}






/* ==================== */
/* ТАБЫ ФИЛЬТРАЦИИ      */
/* ==================== */

.chat-tabs {
    display: flex;
    gap: 8px;
    padding: 0 16px 12px;
    overflow-x: auto;
}

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

.chat-tab {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: #F1F5F9;
    color: #64748B;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.chat-tab:hover {
    background: #E2E8F0;
}

.chat-tab.active {
    background: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 100%);
    color: white;
}

/* ==================== */
/* МЕНЮ ЧАТА            */
/* ==================== */

.chat-header {
    position: relative;
}

.chat-menu {
    position: absolute;
    top: 100%;
    right: 12px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 100;
    overflow: hidden;
}

.chat-menu.hidden {
    display: none;
}

.chat-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chat-menu-item:hover {
    background: #F3F4F6;
}

.chat-menu-item svg {
    width: 18px;
    height: 18px;
    stroke: #6B7280;
}

.chat-menu-item.danger {
    color: #DC2626;
}

.chat-menu-item.danger svg {
    stroke: #DC2626;
}

.chat-menu-item.danger:hover {
    background: #FEF2F2;
}

/* ==================== */
/* СТАТУС ЧАТА В СПИСКЕ */
/* ==================== */

.chat-item.resolved {
    opacity: 0.6;
}

.chat-item.resolved .chat-avatar {
    background: #9CA3AF;
}

.chat-status-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
}

.chat-status-badge.open {
    background: #DCFCE7;
    color: #16A34A;
}

.chat-status-badge.resolved {
    background: #F3F4F6;
    color: #6B7280;
}

/* ==================== */
/* УДАЛЕНИЕ СООБЩЕНИЙ   */
/* ==================== */

.message .delete-btn {
    display: none;
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.message:hover .delete-btn {
    display: flex;
}

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

.message.deleted .message-text {
    color: #9CA3AF;
    font-style: italic;
}

/* Ссылки в сообщениях */
.message-text a {
    color: #41C8E5;
    text-decoration: underline;
}

.message.own .message-text a,
.message.admin .message-text a {
    color: white;
}


/* ==================== */
/* ПУБЛИЧНЫЕ ЧАТЫ       */
/* ==================== */

.chat-item.chat-public {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(16, 185, 129, 0.08) 100%);
    border-left: 3px solid #22C55E;
}

.public-avatar {
    background: linear-gradient(135deg, #22C55E 0%, #10B981 100%) !important;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.public-avatar svg {
    stroke: white !important;
}









/* ==================== */
/* КНОПКА СОЗДАНИЯ ЧАТА */
/* ==================== */

.btn-add-chat {
    margin-left: auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);  /* ← БЫЛО var(--gradient) */
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-add-chat svg {
    width: 18px;
    height: 18px;
    stroke: white;
}

.btn-add-chat:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(65, 200, 229, 0.4);
}

.btn-add-chat.hidden {
    display: none;
}

/* ==================== */
/* POPUP СОЗДАНИЯ ЧАТА  */
/* ==================== */

.create-chat-popup-content {
    max-width: 400px;
    width: 90%;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.popup-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.popup-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #F1F5F9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.popup-close-btn:hover {
    background: #E2E8F0;
}

.popup-close-btn svg {
    width: 18px;
    height: 18px;
    stroke: #64748B;
}
/* Radio группы */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #F8FAFC;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--white);
    position: relative;
}

.radio-label:hover {
    background: #F1F5F9;
}

.radio-label:has(input:checked) {
    background: rgba(77, 194, 71, 0.1);
    border-color: var(--lime);
}

.radio-label input {
    display: none;
}

/* Скрываем старый radio-mark */
.radio-mark {
    display: none;
}

/* Галочка справа для выбранного */
.radio-label::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    opacity: 0;
    transition: opacity 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234DC247' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.radio-label:has(input:checked)::after {
    opacity: 1;
}

.radio-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 28px;
}

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

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

/* ==================== */
/* ПУБЛИЧНЫЕ ЧАТЫ       */
/* ==================== */

.chat-item.chat-public {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(16, 185, 129, 0.08) 100%);
    border-left: 3px solid #22C55E;
}

.public-avatar {
    background: linear-gradient(135deg, #22C55E 0%, #10B981 100%) !important;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.public-avatar svg {
    stroke: white !important;
}




/* Кнопка "Позже" в push popup */
.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 14px;
    padding: 12px;
    cursor: pointer;
    width: 100%;
    margin-top: 8px;
    transition: color 0.2s;
}

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





/* ========== ФОРМА РЕГИСТРАЦИИ ========== */
.form-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 14px;
}

.input-row {
    display: flex;
    gap: 12px;
}

.input-row .input-group {
    flex: 1;
}

.auth-switch {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.auth-switch p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--cyan);
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    padding: 8px 16px;
}

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



/* ========== ПОДСКАЗКА ДЛЯ УЧИТЕЛЬСКОГО КАНАЛА ========== */
.teacher-channel-hint {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(167, 139, 250, 0.1) 100%);
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.teacher-channel-hint svg {
    width: 24px;
    height: 24px;
    color: #8B5CF6;
    flex-shrink: 0;
    margin-top: 2px;
}

.teacher-channel-hint strong {
    display: block;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 4px;
}

.teacher-channel-hint p {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0;
}

.hidden {
    display: none !important;
}




/* Загрузка групп */
.groups-loading {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 8px 0;
}