/* ====================================
   ИИ-Коуч - Фирменный дизайн 2025
   Современный, яркий, вдохновляющий
   ==================================== */

   :root {
    /* 🎨 Фирменные цвета */
    --brand-primary: #6366f1;
    --brand-secondary: #8b5cf6;
    --brand-accent: #ec4899;
    --brand-success: #10b981;
    
    /* ✨ Премиум градиенты */
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    --primary-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
    --secondary-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --glass-gradient: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.4) 100%);
    
    /* 🎯 Основная палитра */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    
    /* 📝 Текст */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    
    /* 🎨 Фоны */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-gradient: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    --bg-dark: #0f172a;
    
    /* 🌈 Фирменные оверлеи */
    --overlay-gradient: linear-gradient(135deg, rgba(99,102,241,0.05) 0%, rgba(139,92,246,0.05) 50%, rgba(236,72,153,0.05) 100%);
    --overlay-hover: linear-gradient(135deg, rgba(99,102,241,0.1) 0%, rgba(139,92,246,0.1) 50%, rgba(236,72,153,0.1) 100%);
    
    /* 📐 Границы */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --border-dark: #cbd5e1;
    
    /* ✨ Тени - усиленные для премиум вида */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.12), 0 2px 8px -2px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 20px -5px rgba(0, 0, 0, 0.15), 0 6px 12px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.2), 0 10px 20px -5px rgba(0, 0, 0, 0.15);
    --shadow-2xl: 0 30px 60px -15px rgba(0, 0, 0, 0.25);
    
    /* 🌟 Фирменное свечение */
    --shadow-glow-primary: 0 0 30px rgba(99, 102, 241, 0.4), 0 0 15px rgba(99, 102, 241, 0.2);
    --shadow-glow-secondary: 0 0 30px rgba(139, 92, 246, 0.4), 0 0 15px rgba(139, 92, 246, 0.2);
    --shadow-glow-accent: 0 0 30px rgba(236, 72, 153, 0.4), 0 0 15px rgba(236, 72, 153, 0.2);
    --shadow-glow-success: 0 0 30px rgba(16, 185, 129, 0.4), 0 0 15px rgba(16, 185, 129, 0.2);
    
    /* 📐 Радиусы - более мягкие */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-full: 9999px;
    
    /* ⚡ Анимации - плавные и быстрые */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    --spring: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ====================================
   КОНТЕЙНЕР И LAYOUT
   ==================================== */

.coach-container {
    min-height: calc(100vh - 60px);
    background: var(--bg-gradient);
    position: relative;
    overflow: hidden;
}

/* Адаптация для ПК */
@media (min-width: 769px) {
    .coach-container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 20px;
    }
    
    .coach-main {
        max-width: 1000px;
        margin: 0 auto;
    }
    
    /* Уменьшенные размеры для ПК версии */
    .goal-info {
        padding: 16px 20px !important;
    }
    
    .goal-header {
        margin-bottom: 8px !important;
        gap: 8px !important;
    }
    
    .goal-header h2 {
        font-size: 20px !important;
    }
    
    .goal-status {
        padding: 4px 10px !important;
        font-size: 10px !important;
    }
    
    .goal-tabs {
        padding: 0 12px !important;
        gap: 2px !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
    }
    
    .tab-btn {
        padding: 8px 12px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
    }
    
    .goal-progress-bar {
        margin: 8px 0 !important;
    }
    
    .goal-deadline {
        margin-top: 8px !important;
    }
    
    .chat-messages {
        padding: 12px 16px !important;
    }
    
    .chat-input-area {
        padding: 12px 16px !important;
    }
    
    .coach-header {
        padding: 8px 0 !important;
        gap: 8px !important;
    }
    
    .btn-goals-list,
    .btn-new-goal-header {
        padding: 8px 16px !important;
        font-size: 13px !important;
    }
}

/* Декоративный фоновый градиент (анимация отключена) */
.coach-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.coach-container::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* ====================================
   ШАПКА С КНОПКАМИ
   ==================================== */

.coach-header {
    padding: 20px 32px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 2px solid var(--border-light);
    display: none;
    gap: 12px;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.coach-header:not(.hidden) {
    display: flex;
}

.coach-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-gradient);
    opacity: 0.3;
}

.btn-goals-list,
.btn-new-goal-header {
    padding: 12px 24px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.btn-goals-list:hover,
.btn-new-goal-header:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-new-goal-header {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

.btn-new-goal-header:hover {
    background: var(--primary-gradient-hover);
    color: white;
    box-shadow: var(--shadow-lg);
}

/* ====================================
   МОДАЛЬНОЕ ОКНО СО СПИСКОМ ЦЕЛЕЙ
   ==================================== */

.goals-modal {
    max-width: 650px;
}

.goals-list-modal {
    max-height: 500px;
    overflow-y: auto;
    padding: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.goals-list-modal::-webkit-scrollbar {
    width: 6px;
}

.goals-list-modal::-webkit-scrollbar-track {
    background: transparent;
}

.goals-list-modal::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.goal-item {
    padding: 18px;
    padding-right: 60px; /* Отступ для кнопки удаления */
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 2px solid var(--border-light);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 12px;
}

.goal-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--primary-gradient);
    transform: scaleY(0);
    transition: transform var(--transition-base);
    border-radius: 0 4px 4px 0;
}

.goal-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-gradient);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.goal-item:hover {
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.goal-item:hover::before {
    transform: scaleY(1);
}

.goal-item:hover::after {
    opacity: 1;
}

.goal-item.active {
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.goal-item.active::before {
    transform: scaleY(1);
}

.goal-item.active::after {
    opacity: 1;
}

.goal-item-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    z-index: 1;
}

/* Markdown форматирование в заголовках целей */
.goal-item-title p {
    margin: 0;
    display: inline;
}

.goal-item-title code {
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    padding: 1px 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.goal-item-title strong {
    font-weight: 800;
}

.goal-item-title em {
    font-style: italic;
}

.goal-item-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.goal-item-progress-bar {
    flex: 1;
    height: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.goal-item-progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    transition: width var(--transition-slow);
    border-radius: var(--radius-full);
    position: relative;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.goal-item-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

.goal-item-content {
    flex: 1;
    position: relative;
    z-index: 1;
}

.goal-item-menu {
    position: absolute;
    top: 15px;
    right: 15px;
    /* transform: translateY(-50%); */
    z-index: 100000;
}

.goal-item-menu-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 2px solid transparent;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    /* opacity: 0; */
    position: absolute;
    right: 0;
    top: 0;
}

.goal-item:hover .goal-item-menu-btn {
    opacity: 1;
}

.goal-item-menu-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: var(--border-color);
    color: var(--text-primary);
    transform: scale(1.1);
}

.goal-item-menu-btn:active {
    transform: scale(0.95);
}

.goal-item-menu-btn i {
    font-size: 18px;
    font-weight: bold;
}

.goal-item-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    width: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    overflow: hidden;
}

.goal-item-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.goal-item-menu-delete {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    color: #ef4444;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.goal-item-menu-delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.goal-item-menu-delete:active {
    background: rgba(239, 68, 68, 0.15);
}

.goal-item-menu-delete i {
    font-size: 16px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ====================================
   ОСНОВНАЯ ОБЛАСТЬ
   ==================================== */

.coach-main {
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 60px);
}

/* ====================================
   ЭКРАН ПРИВЕТСТВИЯ
   ==================================== */

.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

.welcome-content {
    max-width: 650px;
    text-align: center;
}

.welcome-icon {
    font-size: 120px;
    margin-bottom: 32px;
    filter: drop-shadow(0 10px 30px rgba(99, 102, 241, 0.3));
    position: relative;
}

.welcome-content h1 {
    font-size: 48px;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 20px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    letter-spacing: -1px;
    position: relative;
}

.welcome-content h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: var(--primary-gradient);
    border-radius: var(--radius-full);
    opacity: 0.5;
}

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

.welcome-content > p {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 56px;
    line-height: 1.7;
    font-weight: 500;
}

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

.welcome-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 56px;
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 28px 20px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    border: 2px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.feature::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-gradient);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.feature:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.feature:hover::before {
    opacity: 1;
}

.feature i {
    font-size: 42px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
    transition: transform var(--transition-base);
}

.feature:hover i {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

.feature span {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
    text-align: center;
}

/* ====================================
   ВИЗАРД ПОСТАНОВКИ ЦЕЛИ
   ==================================== */

.goal-wizard-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.wizard-content {
    max-width: 750px;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 48px;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    border: 2px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.wizard-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--primary-gradient);
}

.wizard-header {
    margin-bottom: 32px;
    position: relative;
}

.wizard-header h2 {
    margin: 0 0 24px 0;
    font-size: 36px;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.wizard-close {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    font-size: 18px;
    z-index: 10;
}

.wizard-close:hover {
    background: var(--error-color);
    color: white;
    transform: scale(1.1);
}

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

.wizard-progress {
    display: flex;
    align-items: center;
    gap: 16px;
}

.wizard-progress-bar {
    flex: 1;
    height: 10px;
    background: var(--bg-tertiary);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.wizard-progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    transition: width var(--transition-slow);
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}

.wizard-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.wizard-progress-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

.wizard-body {
    margin-bottom: 32px;
    min-height: 320px;
}

.wizard-question {
    margin-bottom: 32px;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.coach-avatar {
    width: 80px;
    height: 80px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.question-text {
    font-size: 20px;
    line-height: 1.7;
    color: var(--text-primary);
    margin: 0;
    font-weight: 500;
}

.wizard-answer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeIn var(--transition-base);
}

.wizard-option {
    position: relative;
}

.wizard-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.wizard-option label {
    display: block;
    padding: 18px 24px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.wizard-option label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--primary-gradient);
    transform: scaleY(0);
    transition: transform var(--transition-base);
}

.wizard-option input[type="radio"]:checked + label {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.wizard-option input[type="radio"]:checked + label::before {
    transform: scaleY(1);
}

.wizard-option label:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.wizard-textarea {
    width: 100%;
    padding: 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: all var(--transition-base);
    color: var(--text-primary);
    line-height: 1.6;
}

.wizard-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

.wizard-textarea::placeholder {
    color: var(--text-muted);
}

.wizard-footer {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: center;
}

.wizard-footer button {
    flex: 1;
}

/* ====================================
   РЕЗУЛЬТАТ ВИЗАРДА
   ==================================== */

/* ====================================
   ИНДИКАТОР ЗАГРУЗКИ ГЕНЕРАЦИИ ЦЕЛИ
   ==================================== */

.goal-generation-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* min-height: 400px; */
    padding: 40px 20px;
    text-align: center;
    animation: fadeIn var(--transition-base);
}

#planGenerationLoader.goal-generation-loader {
    display: block;
    padding: 0;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, .3);
    z-index: 100000000;
}

#planGenerationLoader .goal-generation-loader-content {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* min-height: 400px; */
    padding: 40px 20px;
    text-align: center;
    animation: fadeIn var(--transition-base);
    position: fixed;
    /* position: absolute; */
    z-index: 1000000000;
    background: white;
    border-radius: 50px;
}

.loader-spinner {
    margin-bottom: 32px;
    text-align: center;
}

.loader-spinner .spinner {
    margin: auto;
    width: 64px;
    height: 64px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loader-content .coach-avatar {
    margin-bottom: 0;
}

.loader-content h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.loader-message {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0;
}

.loader-dots {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    text-align: center;
    width: auto;
}

.loader-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: pulse 1.4s ease-in-out infinite;
}

.loader-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loader-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.wizard-result {
    text-align: center;
    animation: fadeIn var(--transition-slow);
}

.result-icon {
    font-size: 96px;
    margin-bottom: 24px;
    animation: bounce 1s;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-10px); }
}

.wizard-result h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 32px;
}

.generated-goal {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 32px;
    text-align: left;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.goal-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.goal-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.goal-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.detail-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

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

.goal-analysis {
    background: var(--bg-primary);
    padding: 10px;
    border-radius: var(--radius-md);
    display: flex;
    gap: 7px;
    align-items: start;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.analysis-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: auto;
}

.goal-analysis p {
    margin: 0;
    line-height: 1.7;
    color: var(--text-secondary);
    font-size: 15px;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ====================================
   ШАБЛОНЫ ЦЕЛЕЙ
   ==================================== */

.goal-templates-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
}

.templates-content {
    max-width: 950px;
    width: 100%;
    background: var(--bg-primary);
    padding: 48px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.templates-content h2 {
    margin: 0 0 32px 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

.templates-grid {
    display: grid;
    gap: 32px;
    margin-bottom: 32px;
    max-height: 550px;
    overflow-y: auto;
    padding-right: 12px;
    scrollbar-width: thin;
}

.template-category h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.template-goals {
    display: grid;
    gap: 12px;
}

.template-goal {
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 15px;
    color: var(--text-primary);
}

.template-goal:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

#btnCustomGoal {
    width: 100%;
    padding: 18px;
    font-size: 17px;
}

/* ====================================
   СОЗДАНИЕ ЦЕЛИ
   ==================================== */

.goal-creation-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.goal-creation-content {
    max-width: 650px;
    width: 100%;
    background: var(--bg-primary);
    padding: 48px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.goal-creation-content h2 {
    margin: 0 0 32px 0;
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 28px;
}

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    transition: all var(--transition-base);
    color: var(--text-primary);
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

.form-actions {
    display: flex;
    gap: 16px;
    margin-top: 32px;
}

/* ====================================
   КНОПКИ
   ==================================== */

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 18px 32px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-md);
    border: 2px solid transparent;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left var(--transition-slow);
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover {
    box-shadow: var(--shadow-lg);
    background: var(--primary-gradient-hover);
}

.btn-primary:hover::before {
    left: 100%;
}

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

.btn-primary:active::after {
    width: 300px;
    height: 300px;
    transition: width 0s, height 0s;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    flex: 1;
    padding: 18px 32px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: 2px solid transparent;
    box-shadow: var(--shadow-md);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: var(--shadow-lg);
}

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

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

.delete-goal-text {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius-md);
    margin: 16px 0;
    border-left: 4px solid var(--primary-color);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
}

.delete-warning {
    color: #ef4444;
    font-size: 13px;
    font-weight: 600;
    margin-top: 12px;
    text-align: center;
}

.btn-large {
    padding: 20px 56px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* Недостающая анимация slideDown */
@keyframes slideDown {
    0%, 100% {
        transform: translateY(-10px);
        opacity: 0.5;
    }
    50% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ====================================
   ЭКРАН ЦЕЛИ
   ==================================== */

.goal-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: calc(100vh - 150px); /* 70px padding-top + 80px padding-bottom */
    min-height: 0;
}

.goal-info {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 32px;
    border-bottom: 2px solid var(--border-light);
    box-shadow: var(--shadow-md);
    position: relative;
}

.goal-info::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-gradient);
    opacity: 0.3;
}

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

.goal-header h2 {
    margin: 0;
    font-size: 30px;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Markdown форматирование в заголовке цели */
#goalTitle p {
    margin: 0;
    display: inline;
}

#goalTitle code {
    background-color: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
    -webkit-text-fill-color: var(--primary-color);
}

#goalTitle strong {
    font-weight: 900;
}

#goalTitle em {
    font-style: italic;
}

.goal-status {
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 800;
    background: var(--info-color);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    box-shadow: var(--shadow-sm);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.goal-status.active {
    background: var(--success-gradient);
    box-shadow: var(--shadow-md);
}

.goal-status.completed {
    background: var(--warning-color);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

.goal-progress-bar {
    position: relative;
    height: 40px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.08);
    border: 2px solid var(--border-light);
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    transition: width 1s cubic-bezier(0.65, 0, 0.35, 1);
    border-radius: var(--radius-full);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.progress-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 100%);
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2.5s infinite;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 800;
    color: var(--text-primary);
    font-size: 16px;
    text-shadow: 0 2px 4px rgba(255,255,255,0.9);
    z-index: 10;
    letter-spacing: 0.5px;
}

.goal-deadline {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

.goal-deadline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.goal-deadline strong {
    color: var(--text-primary);
}

.btn-edit-deadline {
    padding: 6px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-edit-deadline:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ====================================
   МОДАЛЬНЫЕ ОКНА
   ==================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000000;
    animation: fadeIn var(--transition-base);
    padding: 20px;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    animation: scaleIn var(--transition-slow);
    overflow: hidden;
    max-height: 100%;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-back {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    z-index: 10;
}

.modal-back:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ====================================
   ВКЛАДКИ
   ==================================== */

.goal-tabs {
    display: flex;
    background: var(--bg-primary);
    border-bottom: 2px solid var(--border-color);
    padding: 0 28px;
    gap: 8px;
}

.tab-btn {
    padding: 18px 28px;
    background: none;
    border: none;
    border-bottom: 4px solid transparent;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    letter-spacing: 0.3px;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-gradient);
    opacity: 0;
    transition: opacity var(--transition-base);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform var(--transition-base);
    border-radius: var(--radius-full);
}

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

.tab-btn:hover::before {
    opacity: 1;
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::before {
    opacity: 1;
}

.tab-btn.active::after {
    transform: scaleX(1);
}

.tab-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.tab-pane {
    display: none;
    height: 100%;
    overflow: hidden;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ====================================
   ЧАТ
   ==================================== */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px 40px;
    background: var(--bg-secondary);
    scrollbar-width: thin;
    max-width: 100%;
    min-height: 0;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
}

.welcome-message h3 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.welcome-message p {
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 600px;
    margin: 0 auto;
}

/* Стили сообщений как в chatbot.php */
.message {
    margin-bottom: 12px;
    position: relative;
}

.message.from-user {
    margin-left: auto;
    max-width: 70%;
}

.message.from-coach,
.message.from-bot {
    max-width: 85%;
}

.message-content {
    padding: 14px 18px;
    border-radius: 15px;
    position: relative;
    font-size: 16px;
    line-height: 1.5;
}

.message.from-user .message-content {
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 5px;
}

.message.from-coach .message-content,
.message.from-bot .message-content {
    background-color: #f0f0f0;
    color: #1a1a1a;
    border-bottom-left-radius: 5px;
}

/* Цвета текста в сообщениях от пользователя */
.message.from-user .message-text {
    color: white;
}

.message.from-user .message-text strong {
    font-weight: 700;
    color: white;
}

.message-text {
    margin: 0;
    line-height: 1.5;
    font-size: 15px;
    font-weight: 400;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    text-align: right;
}

.message.from-user .message-time {
    color: rgba(255,255,255,0.8);
}

.chat-input-area {
    display: flex;
    gap: 12px;
    padding: 24px 40px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
}

#chatInput {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    transition: all var(--transition-base);
    line-height: 1.5;
}

#chatInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

.btn-send {
    width: 58px;
    height: 58px;
    border: none;
    background: var(--primary-gradient);
    color: white;
    border-radius: var(--radius-md);
    font-size: 24px;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.btn-send::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-send:hover {
    box-shadow: var(--shadow-lg);
    background: var(--primary-gradient-hover);
}

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

.btn-send:active::before {
    width: 200px;
    height: 200px;
    transition: width 0s, height 0s;
}

/* ====================================
   РОАДМАП
   ==================================== */

.roadmap-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}

.roadmap-header {
    padding: 24px 28px 16px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.roadmap-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.roadmap-controls {
    display: flex;
    gap: 12px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}

.roadmap-timeline {
    flex: 1;
    overflow-y: auto;
    padding: 32px 28px;
    position: relative;
}

.roadmap-path {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.roadmap-path::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    transform: translateX(-50%);
    border-radius: 2px;
    z-index: 1;
}

.roadmap-milestone {
    position: relative;
    margin-bottom: 60px;
    display: flex;
    align-items: center;
}

.roadmap-milestone:nth-child(even) {
    flex-direction: row-reverse;
}

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

.roadmap-milestone-content {
    width: calc(50% - 30px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 28px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border-light);
    position: relative;
    transition: all var(--transition-base);
}

.roadmap-milestone:hover .roadmap-milestone-content {
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.roadmap-milestone.completed .roadmap-milestone-content {
    border-color: var(--success-color);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(255, 255, 255, 0.95) 100%);
    box-shadow: var(--shadow-glow-success);
}

.roadmap-milestone.active .roadmap-milestone-content {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(255, 255, 255, 0.95) 100%);
    box-shadow: var(--shadow-lg);
}

.roadmap-milestone-content::before {
    content: '';
    position: absolute;
    top: 50%;
    width: 0;
    height: 0;
    border: 12px solid transparent;
    z-index: 2;
}

.roadmap-milestone:nth-child(odd) .roadmap-milestone-content::before {
    right: -24px;
    border-left-color: var(--border-color);
    transform: translateY(-50%);
}

.roadmap-milestone:nth-child(even) .roadmap-milestone-content::before {
    left: -24px;
    border-right-color: var(--border-color);
    transform: translateY(-50%);
}

.roadmap-milestone.completed .roadmap-milestone-content::before {
    border-left-color: var(--success-color);
    border-right-color: var(--success-color);
}

.roadmap-milestone.active .roadmap-milestone-content::before {
    border-left-color: var(--primary-color);
    border-right-color: var(--primary-color);
}

.roadmap-milestone-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: var(--bg-primary);
    border: 5px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: var(--text-secondary);
    z-index: 3;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-lg);
}

.roadmap-milestone-icon::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all var(--transition-base);
}

.roadmap-milestone.completed .roadmap-milestone-icon {
    background: var(--success-gradient);
    border-color: var(--success-color);
    color: white;
    box-shadow: var(--shadow-lg);
}

.roadmap-milestone.completed .roadmap-milestone-icon::before {
    border-color: var(--success-color);
    opacity: 0.3;
}

.roadmap-milestone.active .roadmap-milestone-icon {
    background: var(--primary-gradient);
    border-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-lg);
}

.roadmap-milestone.active .roadmap-milestone-icon::before {
    border-color: var(--primary-color);
    opacity: 0.3;
}

.roadmap-milestone-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
}

/* Markdown форматирование в заголовках этапов */
.roadmap-milestone-title p {
    margin: 0;
    display: inline;
}

.roadmap-milestone-title code {
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    padding: 1px 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
}

.roadmap-milestone-title strong {
    font-weight: 900;
}

.roadmap-milestone-title em {
    font-style: italic;
}

.roadmap-milestone-date {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.roadmap-milestone-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    font-size: 15px;
}

/* Markdown форматирование в описаниях этапов роадмапа */
.roadmap-milestone-description p {
    margin: 4px 0;
}

.roadmap-milestone-description p:first-child {
    margin-top: 0;
}

.roadmap-milestone-description p:last-child {
    margin-bottom: 0;
}

.roadmap-milestone-description code {
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    padding: 1px 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.roadmap-milestone-description strong {
    font-weight: 700;
}

.roadmap-milestone-description em {
    font-style: italic;
}

.roadmap-milestone-description ul,
.roadmap-milestone-description ol {
    margin: 8px 0;
    padding-left: 20px;
}

.roadmap-milestone-description li {
    margin: 4px 0;
}

.roadmap-milestone-tasks {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-top: 16px;
}

.roadmap-milestone-tasks-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.roadmap-milestone-tasks ul {
    margin: 0;
    padding-left: 20px;
    list-style-type: none;
}

.roadmap-milestone-tasks li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.roadmap-milestone-tasks li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--primary-color);
    font-weight: 700;
}

/* Markdown форматирование в задачах этапов */
.roadmap-milestone-tasks li p {
    margin: 0;
    display: inline;
}

.roadmap-milestone-tasks li code {
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    padding: 1px 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.roadmap-milestone-tasks li strong {
    font-weight: 700;
}

.roadmap-milestone-tasks li em {
    font-style: italic;
}

.roadmap-milestone-progress {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.roadmap-milestone-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.roadmap-milestone-status {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
}

.roadmap-milestone-status.completed {
    color: var(--success-color);
}

.roadmap-milestone-status.active {
    color: var(--primary-color);
}

.roadmap-milestone-status.pending {
    color: var(--text-muted);
}

/* ====================================
   ПЛАН ДЕЙСТВИЙ
   ==================================== */

.milestones-container {
    padding: 24px;
}

.milestones-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.milestones-header h3 {
    margin: 0 0 16px 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.milestones-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.milestones-controls .btn-secondary {
    margin: 0;
}

.milestones-list {
    padding: 28px;
    overflow-y: auto;
    background: var(--bg-secondary);
}

.milestone-item {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 28px;
    border-radius: var(--radius-xl);
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    border-left: 6px solid var(--border-color);
    transition: all var(--transition-base);
    position: relative;
}

.milestone-item:hover {
    box-shadow: var(--shadow-lg);
}

.milestone-item.completed {
    border-left-color: var(--success-color);
    opacity: 0.8;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.milestone-item.completed .milestone-title {
    text-decoration: line-through;
    opacity: 0.7;
}

.milestone-item.active {
    border-left-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(--bg-primary) 100%);
}

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

.milestone-title {
    font-weight: 800;
    font-size: 22px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

/* Markdown форматирование в заголовках этапов (план действий) */
.milestone-title p {
    margin: 0;
    display: inline;
}

.milestone-title code {
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    padding: 1px 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
}

.milestone-title strong {
    font-weight: 900;
}

.milestone-title em {
    font-style: italic;
}

.milestone-checkbox {
    width: 28px;
    height: 28px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.milestone-description {
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.7;
    font-size: 15px;
}

/* Markdown форматирование в описаниях этапов плана действий */
.milestone-description p {
    margin: 4px 0;
}

.milestone-description p:first-child {
    margin-top: 0;
}

.milestone-description p:last-child {
    margin-bottom: 0;
}

.milestone-description code {
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    padding: 1px 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.milestone-description strong {
    font-weight: 700;
}

.milestone-description em {
    font-style: italic;
}

.milestone-description ul,
.milestone-description ol {
    margin: 8px 0;
    padding-left: 20px;
}

.milestone-description li {
    margin: 4px 0;
}

.milestone-deadline {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
}

.milestone-tasks {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.milestone-tasks-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.milestone-tasks ul {
    margin: 0;
    padding-left: 24px;
}

.milestone-tasks li {
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.6;
}

/* Markdown форматирование в задачах плана действий */
.milestone-tasks li p {
    margin: 0;
    display: inline;
}

.milestone-tasks li code {
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    padding: 1px 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.milestone-tasks li strong {
    font-weight: 700;
}

.milestone-tasks li em {
    font-style: italic;
}

/* Стили для отдельных задач с чекбоксами */
.task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    transition: all var(--transition-base);
    border: 1px solid var(--border-color);
}

.task-item:hover {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

.task-item.completed {
    opacity: 0.7;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-item.highlight-next {
    background: linear-gradient(135deg, var(--primary-color-light), var(--primary-color));
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.3);
    animation: pulse-highlight 2s ease-in-out;
}

.task-item.highlight-next .task-text {
    color: white;
    text-decoration: none;
}

.task-item.highlight-next .task-actions button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.task-item.highlight-next .task-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

@keyframes pulse-highlight {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.task-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
    flex-shrink: 0;
    margin-top: 2px;
    position: static !important;
}

.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.task-text p {
    margin: 0;
    display: inline;
}

.task-text code {
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    padding: 1px 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.task-text strong {
    font-weight: 700;
}

.task-text em {
    font-style: italic;
}

.task-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.btn-task-chat {
    padding: 4px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-task-chat:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-task-chat i {
    font-size: 14px;
}

.btn-task-diary {
    padding: 4px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

.btn-task-diary:hover {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.btn-task-diary i {
    font-size: 14px;
}

/* Модальное окно чата по задаче */
.task-chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    z-index: 100000000;
}

.task-chat-content {
    background: var(--bg-primary);
    width: 100%;
    height: 100%;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.task-chat-header {
    padding: 24px 40px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    position: relative;
}

.task-chat-title-section {
    flex: 1;
}

.task-chat-title-section h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.task-chat-task-text {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.task-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px 40px;
    background: var(--bg-secondary);
    scrollbar-width: thin;
    max-width: 100%;
}

/* Сообщения в модальном окне задачи используют те же стили что и в основном чате */

.task-chat-input-area {
    display: flex;
    gap: 12px;
    padding: 20px 40px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.task-chat-input-area textarea {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    transition: all var(--transition-base);
    line-height: 1.5;
}

.task-chat-input-area textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.task-chat-input-area .btn-send {
    width: 50px;
    height: 50px;
}

/* Адаптивность модального окна задачи */
@media (max-width: 768px) {
    .task-chat-header {
        padding: 16px 20px;
    }
    
    .task-chat-messages {
        padding: 20px;
    }

    .task-chat-input-area {
        padding: 16px 20px;
    }

    .message.from-user {
        max-width: 85%;
    }

    .message.from-coach,
    .message.from-bot {
        max-width: 92%;
    }
}

/* ====================================
   ДОСТИЖЕНИЯ
   ==================================== */

.achievements-grid {
    padding: 28px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    overflow-y: auto;
    background: var(--bg-secondary);
}

.achievement-item {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 28px;
    border-radius: var(--radius-xl);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    border: 2px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.achievement-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-gradient);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.achievement-item:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.achievement-item:hover::before {
    opacity: 1;
}

.achievement-item.locked {
    opacity: 0.4;
    filter: grayscale(100%);
}

.achievement-item.locked:hover {
    transform: none;
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
}

.achievement-item.locked::before {
    opacity: 0;
}

/* ========================================
   Анимация достижений
   ======================================== */

.achievement-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border: 3px solid var(--success-color);
    z-index: 10000;
    text-align: center;
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.achievement-popup.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.achievement-popup-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: achievementBounce 0.6s ease-out;
}

.achievement-popup-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.achievement-popup-description {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.achievement-popup-button {
    background: var(--success-gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.achievement-popup-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4);
}

.achievement-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.achievement-popup-overlay.show {
    opacity: 1;
}

@keyframes achievementBounce {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes achievementGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(34, 197, 94, 0.8);
    }
}

.achievement-popup.show {
    animation: achievementGlow 2s ease-in-out infinite;
}

.achievement-icon {
    font-size: 64px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
    transition: transform var(--transition-base);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.achievement-item:hover .achievement-icon {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

.achievement-title {
    font-weight: 800;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.achievement-description {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    z-index: 1;
    line-height: 1.5;
}

/* ====================================
   МОДАЛЬНОЕ ОКНО ПОДПИСКИ
   ==================================== */

.subscription-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn var(--transition-base);
    padding: 20px;
}

.subscription-modal-content {
    background: var(--bg-primary);
    padding: 48px;
    border-radius: var(--radius-xl);
    max-width: 550px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: scaleIn var(--transition-slow);
}

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


.subscription-modal-content h2 {
    margin: 0 0 16px 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.subscription-modal-content p {
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.7;
    font-size: 16px;
}

.subscription-actions {
    display: flex;
    gap: 16px;
}

.subscription-actions .btn-primary,
.subscription-actions .btn-secondary {
    flex: 1;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ====================================
   УТИЛИТЫ
   ==================================== */

.hidden {
    display: none !important;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 15px;
}

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

/* ====================================
   АДАПТИВНЫЙ ДИЗАЙН
   ==================================== */

@media (max-width: 1024px) {
    .coach-sidebar {
        width: 280px;
    }
    
    .wizard-content,
    .goal-creation-content,
    .templates-content {
        padding: 36px;
    }
}

@media (max-width: 768px) {
    .coach-header {
        padding: 16px 20px;
    }

    .btn-goals-list span,
    .btn-new-goal-header span {
        display: none;
    }

    .btn-goals-list,
    .btn-new-goal-header {
        padding: 10px 12px;
    }

    .goals-modal {
        max-width: 95%;
        margin: 10px;
    }

    .welcome-icon {
        font-size: 72px;
    }

    .welcome-content h1 {
        font-size: 32px;
    }

    .welcome-content > p {
        font-size: 16px;
    }

    .welcome-features {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .feature {
        padding: 20px;
    }

    .wizard-content,
    .goal-creation-content,
    .templates-content {
        padding: 28px 24px;
        border-radius: var(--radius-lg);
    }

    .wizard-header h2,
    .goal-creation-content h2 {
        font-size: 26px;
    }

    .wizard-body {
        min-height: 250px;
    }

    .coach-avatar {
        width: 60px;
        height: 60px;
        font-size: 30px;
    }

    .question-text {
        font-size: 18px;
    }

    .wizard-option label {
        padding: 16px 20px;
        font-size: 15px;
    }

    .goal-details {
        grid-template-columns: 1fr;
    }

    .result-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    .goal-tabs {
        padding: 0 20px;
        gap: 4px;
        overflow-x: auto;
    }

    .tab-btn {
        padding: 14px 16px;
        font-size: 14px;
        white-space: nowrap;
    }

    .goal-info {
        padding: 20px;
    }

    .goal-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .goal-header h2 {
        font-size: 22px;
    }

    .message.from-user {
        max-width: 80%;
    }

    .message.from-coach,
    .message.from-bot {
        max-width: 90%;
    }

    .chat-input-area {
        padding: 16px 20px;
    }

    .btn-send {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .milestones-list,
    .achievements-grid {
        padding: 20px;
    }

    .chat-messages {
        padding: 20px;
    }

    .milestone-item {
        padding: 20px;
    }

    .milestone-title {
        font-size: 18px;
    }

    .achievements-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 16px;
    }

    .subscription-modal-content {
        padding: 32px 24px;
    }

    .wizard-footer {
        flex-direction: column;
    }

    .wizard-footer button {
        width: 100%;
    }

    /* Роадмап на планшетах */
    .roadmap-header {
        padding: 20px;
        flex-direction: column;
        align-items: stretch;
    }

    .roadmap-controls {
        justify-content: center;
        flex-wrap: wrap;
    }

    .roadmap-timeline {
        padding: 24px 20px;
    }

    .roadmap-milestone-content {
        width: calc(50% - 20px);
        padding: 20px;
    }

    .roadmap-milestone-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .welcome-screen,
    .goal-wizard-screen,
    .goal-creation-screen,
    .goal-templates-screen {
        padding: 20px 16px;
    }

    .wizard-content,
    .goal-creation-content,
    .templates-content {
        padding: 24px 20px;
    }

    .welcome-content h1 {
        font-size: 28px;
    }

    .wizard-header h2 {
        font-size: 24px;
    }

    .question-text {
        font-size: 16px;
    }

    .goal-value {
        font-size: 19px;
    }

    .form-group input,
    .form-group textarea,
    .form-group select,
    #chatInput {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .achievements-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    /* Роадмап на мобильных */
    .roadmap-path::before {
        left: 30px;
        transform: none;
    }

    .roadmap-milestone {
        flex-direction: column !important;
        margin-bottom: 40px;
        padding-left: 60px;
    }

    .roadmap-milestone-content {
        width: 100%;
        margin-bottom: 0;
    }

    .roadmap-milestone-content::before {
        display: none;
    }

    .roadmap-milestone-icon {
        position: absolute;
        left: 0;
        top: 20px;
        width: 40px;
        height: 40px;
        font-size: 16px;
        transform: none;
    }

    .roadmap-milestone-title {
        font-size: 16px;
    }

    .roadmap-milestone-description {
        font-size: 14px;
    }

    .roadmap-milestone-tasks {
        padding: 12px;
    }

    .roadmap-milestone-tasks li {
        font-size: 13px;
    }

    /* Модальные окна на мобильных */
    .modal-content {
        margin: 10px;
        max-width: calc(100vw - 20px);
    }

    .modal-header {
        padding: 20px 20px 12px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 12px 20px 20px;
        flex-direction: column;
    }

    .modal-footer button {
        width: 100%;
    }
}

/* Улучшения прокрутки для мобильных */
@media (hover: none) and (pointer: coarse) {
    .goals-list,
    .chat-messages,
    .milestones-list,
    .achievements-grid,
    .templates-grid {
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================
   СТИЛИ ДЛЯ MARKDOWN ФОРМАТИРОВАНИЯ
   ============================================ */

/* Стили для форматирования кода */
.goal-value code,
.goal-analysis code {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.goal-value pre,
.goal-analysis pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.4;
}

.goal-value pre code,
.goal-analysis pre code {
    background: none;
    border: none;
    padding: 0;
    color: #333;
    font-size: inherit;
}

/* Стили для таблиц в сообщениях */
.goal-value .markdown-table,
.goal-analysis .markdown-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.goal-value .markdown-table th,
.goal-analysis .markdown-table th {
    background: var(--primary-color-light);
    color: var(--text-color);
    font-weight: bold;
    padding: 12px 8px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    font-size: 13px;
}

.goal-value .markdown-table td,
.goal-analysis .markdown-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
    font-size: 13px;
    line-height: 1.4;
}

.goal-value .markdown-table tr:hover,
.goal-analysis .markdown-table tr:hover {
    background-color: #f8f9fa;
}

.goal-value .markdown-table tr:last-child td,
.goal-analysis .markdown-table tr:last-child td {
    border-bottom: none;
}

/* Стили для списков */
.goal-value ul,
.goal-value ol,
.goal-analysis ul,
.goal-analysis ol {
    margin: 8px 0;
    padding-left: 24px;
}

.goal-value ul,
.goal-analysis ul {
    list-style-type: disc;
}

.goal-value ol,
.goal-analysis ol {
    list-style-type: decimal;
}

.goal-value li,
.goal-analysis li {
    margin: 4px 0;
    line-height: 1.5;
}

/* Стили для заголовков */
.goal-value h1,
.goal-analysis h1 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 16px 0 12px 0;
    padding: 8px 0;
    line-height: 1.3;
}

.goal-value h2,
.goal-analysis h2 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 14px 0 10px 0;
    padding: 6px 0;
    line-height: 1.3;
}

.goal-value h3,
.goal-analysis h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 12px 0 8px 0;
    padding: 4px 0;
    line-height: 1.4;
}

/* Стили для параграфов */
.goal-value p,
.goal-analysis p {
    margin: 8px 0;
    line-height: 1.6;
}

.goal-value p:first-child,
.goal-analysis p:first-child {
    margin-top: 0;
}

.goal-value p:last-child,
.goal-analysis p:last-child {
    margin-bottom: 0;
}

/* Стили для жирного текста и курсива */
.goal-value strong,
.goal-analysis strong {
    font-weight: 600;
}

.goal-value em,
.goal-analysis em {
    font-style: italic;
}

/* Стили для ссылок */
.goal-value a,
.goal-analysis a {
    color: var(--primary-color);
    text-decoration: none;
}

.goal-value a:hover,
.goal-analysis a:hover {
    text-decoration: underline;
}

/* Стили для горизонтальных разделителей */
.goal-value .markdown-divider,
.goal-analysis .markdown-divider {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ddd, transparent);
    margin: 16px 0;
    border-radius: 1px;
}

/* ============================================
   СТИЛИ ДЛЯ СПИННЕРА ЗАГРУЗКИ
   ============================================ */

/* Спиннер для кнопок */
.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes btn-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Стили для заблокированных кнопок */
.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transition: opacity 0.3s ease;
}

.btn-primary:disabled {
    background: var(--primary-color);
}

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

/* Плавный переход для всех кнопок */
.btn-primary,
.btn-secondary {
    transition: all 0.3s ease;
}

/* ============================================
   MARKDOWN ФОРМАТИРОВАНИЕ В СООБЩЕНИЯХ И ЭТАПАХ
   ============================================ */

/* Стили для кода в сообщениях */
.message-text code,
.milestone-description code,
.milestone-tasks code {
    background-color: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.message.from-user .message-text code {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.95);
}

.message-text pre,
.milestone-description pre,
.milestone-tasks pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.4;
}

.message-text pre code,
.milestone-description pre code,
.milestone-tasks pre code {
    background: none;
    border: none;
    padding: 0;
    color: #333;
    font-size: inherit;
}

/* Стили для таблиц */
.message-text .markdown-table,
.milestone-description .markdown-table,
.milestone-tasks .markdown-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-text .markdown-table th,
.milestone-description .markdown-table th,
.milestone-tasks .markdown-table th {
    background: var(--primary-color-light);
    color: var(--text-color);
    font-weight: bold;
    padding: 12px 8px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    font-size: 13px;
}

.message-text .markdown-table td,
.milestone-description .markdown-table td,
.milestone-tasks .markdown-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
    font-size: 13px;
    line-height: 1.4;
}

.message-text .markdown-table tr:hover,
.milestone-description .markdown-table tr:hover,
.milestone-tasks .markdown-table tr:hover {
    background-color: #f8f9fa;
}

.message-text .markdown-table tr:last-child td,
.milestone-description .markdown-table tr:last-child td,
.milestone-tasks .markdown-table tr:last-child td {
    border-bottom: none;
}

/* Стили для списков */
.message-text ul,
.message-text ol,
.milestone-description ul,
.milestone-description ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-text ul,
.milestone-description ul {
    list-style-type: disc;
}

.message-text ol,
.milestone-description ol {
    list-style-type: decimal;
}

.message-text li,
.milestone-description li {
    margin: 4px 0;
    line-height: 1.5;
}

/* Стили для заголовков */
.message-text h1,
.milestone-description h1 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 16px 0 12px 0;
    padding: 8px 0;
    line-height: 1.3;
}

.message-text h2,
.milestone-description h2 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 14px 0 10px 0;
    padding: 6px 0;
    line-height: 1.3;
}

.message-text h3,
.milestone-description h3 {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 12px 0 8px 0;
    padding: 4px 0;
    line-height: 1.4;
}

/* Стили для параграфов */
.message-text p,
.milestone-description p {
    margin: 6px 0;
    line-height: 1.5;
}

.message-text p:first-child,
.milestone-description p:first-child {
    margin-top: 0;
}

.message-text p:last-child,
.milestone-description p:last-child {
    margin-bottom: 0;
}

/* Стили для жирного текста и курсива */
.message-text strong,
.milestone-description strong,
.milestone-tasks strong {
    font-weight: 700;
}

.message-text em,
.milestone-description em,
.milestone-tasks em {
    font-style: italic;
}

/* Стили для списков в сообщениях */
.message-text ul li::marker,
.message-text ol li::marker {
    color: var(--text-primary);
}

.message.from-user .message-text ul li::marker,
.message.from-user .message-text ol li::marker {
    color: rgba(255, 255, 255, 0.9);
}

/* Стили для ссылок */
.message-text a,
.milestone-description a,
.milestone-tasks a {
    color: var(--primary-color);
    text-decoration: none;
}

.message-text a:hover,
.milestone-description a:hover,
.milestone-tasks a:hover {
    text-decoration: underline;
}

.message.from-user .message-text a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: underline;
}

.message.from-user .message-text a:hover {
    color: white;
}

/* Стили для горизонтальных разделителей */
.message-text .markdown-divider,
.milestone-description .markdown-divider {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ddd, transparent);
    margin: 16px 0;
    border-radius: 1px;
}

/* ============================================
   ИНДИКАТОР ПЕЧАТАНИЯ СООБЩЕНИЯ
   ============================================ */

.typing-indicator {
    display: none;
    padding: 12px 16px;
    background: #f0f0f0;
    border-radius: 15px;
    border-bottom-left-radius: 5px;
    margin-bottom: 12px;
    max-width: 80px;
}

.typing-indicator.show {
    display: block;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #6C757D;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite;
}

.typing-dots span:nth-child(2) { 
    animation-delay: 0.2s; 
}

.typing-dots span:nth-child(3) { 
    animation-delay: 0.4s; 
}

@keyframes typing-bounce {
    0%, 60%, 100% { 
        transform: translateY(0); 
        opacity: 0.7;
    }
    30% { 
        transform: translateY(-10px); 
        opacity: 1;
    }
}


div {
    box-sizing: border-box;
}

/* ============================================
   МОДАЛЬНЫЕ ОКНА ГЕНЕРАЦИИ ПЛАНА
   ============================================ */

/* Оверлей прогресса генерации */
.plan-generation-overlay,
.plan-success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn var(--transition-base);
    padding: 20px;
}

/* Модальное окно генерации */
.plan-generation-modal,
.plan-success-modal {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    padding: 48px;
    max-width: 600px;
    width: 100%;
    box-shadow: var(--shadow-2xl);
    animation: scaleIn var(--transition-slow);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.plan-generation-modal::before,
.plan-success-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--primary-gradient);
}

/* Иконка генерации */
.generation-icon,
.success-icon {
    font-size: 80px;
    margin-bottom: 24px;
}

.success-icon {
    font-size: 96px;
}

.plan-generation-modal h3,
.plan-success-modal h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    letter-spacing: -0.5px;
}

/* Шаги генерации */
.generation-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 32px 0;
    text-align: left;
}

.generation-steps .step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    opacity: 0.5;
}

.generation-steps .step.active {
    opacity: 1;
    background: var(--overlay-gradient);
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.generation-steps .step i {
    font-size: 20px;
    color: var(--text-muted);
    transition: color var(--transition-base);
}

.generation-steps .step.active i {
    color: var(--primary-color);
}

.generation-steps .step span {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
}

.generation-steps .step.active span {
    color: var(--text-primary);
}

/* Спиннер загрузки */
.generation-spinner {
    margin: 32px 0 24px;
}

.generation-spinner .spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    border: 5px solid var(--bg-tertiary);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.generation-hint {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
    font-weight: 500;
}

/* Модальное окно успеха */
.motivation-message {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0 0 32px 0;
    font-weight: 500;
}

/* Статистика плана */
.plan-stats {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-bottom: 32px;
}

.plan-stats .stat {
    flex: 1;
    max-width: 150px;
    padding: 24px;
    background: var(--overlay-gradient);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.plan-stats .stat-value {
    font-size: 42px;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

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

/* Инсайты */
.plan-insights {
    background: rgba(99, 102, 241, 0.05);
    padding: 24px;
    border-radius: var(--radius-lg);
    text-align: left;
    margin-bottom: 32px;
    border-left: 4px solid var(--primary-color);
}

.plan-insights h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.plan-insights ul {
    margin: 0;
    padding-left: 24px;
    list-style-type: none;
}

.plan-insights li {
    position: relative;
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    font-weight: 500;
}

.plan-insights li:last-child {
    margin-bottom: 0;
}

.plan-insights li::before {
    content: '✓';
    position: absolute;
    left: -24px;
    color: var(--primary-color);
    font-weight: 700;
}

/* Адаптивность модальных окон */
@media (max-width: 768px) {
    .plan-generation-modal,
    .plan-success-modal {
        padding: 32px 24px;
    }
    
    .generation-icon,
    .success-icon {
        font-size: 64px;
    }
    
    .plan-generation-modal h3,
    .plan-success-modal h2 {
        font-size: 24px;
    }
    
    .plan-stats {
        flex-direction: column;
        gap: 16px;
    }
    
    .plan-stats .stat {
        max-width: none;
    }
    
    .generation-steps .step {
        padding: 12px 16px;
    }
}

/* ====================================
   РЕДАКТИРОВАНИЕ ПЛАНА
   ==================================== */

.plan-edit-modal {
    max-width: 95vw;
    max-height: 95vh;
    width: 95vw;
    height: 95vh;
    overflow-y: auto;
    margin: 0;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.plan-edit-content {
    padding: 0;
    max-height: calc(95vh - 120px);
    overflow-y: auto;
}

.plan-edit-instructions {
    background: var(--bg-tertiary);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border-left: 4px solid var(--primary-color);
}

.plan-edit-instructions p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.plan-edit-milestones {
    margin-bottom: 24px;
}

.plan-edit-milestone {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border-light);
    transition: all var(--transition-base);
    position: relative;
}

.plan-edit-milestone:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.plan-edit-milestone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 16px;
}

.plan-edit-milestone-title {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    border: none;
    background: transparent;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    transition: all var(--transition-base);
}

.plan-edit-milestone-title:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

.plan-edit-milestone-actions {
    display: flex;
    gap: 8px;
}

.plan-edit-milestone-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.plan-edit-milestone-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.plan-edit-milestone-btn.danger:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

.plan-edit-milestone-description {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: all var(--transition-base);
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.plan-edit-milestone-description:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.plan-edit-milestone-description::placeholder {
    color: var(--text-muted);
}

.plan-edit-milestone-deadline {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.plan-edit-milestone-deadline label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.plan-edit-milestone-deadline input {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition-base);
    color: var(--text-primary);
    box-sizing: border-box;
}

.plan-edit-milestone-deadline input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.plan-edit-milestone-tasks {
    margin-top: 16px;
}

.plan-edit-milestone-tasks-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.plan-edit-task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
}

.plan-edit-task-item:hover {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

.plan-edit-task-item.completed {
    background: rgba(var(--success-color-rgb), 0.1);
    border-color: var(--success-color);
}

.plan-edit-task-item.completed .plan-edit-task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.plan-edit-task-checkbox {
    flex-shrink: 0;
    margin-top: 2px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--success-color);
}

.plan-edit-task-text {
    flex: 1;
    border: none;
    background: transparent;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    line-height: 1.4;
    resize: none;
    min-height: 20px;
    transition: all var(--transition-base);
    width: 100%;
}

.plan-edit-task-text:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

.plan-edit-task-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.plan-edit-task-btn {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 2px;
}

.plan-edit-task-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.plan-edit-task-btn.danger:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

.plan-edit-add-task {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    margin-top: 8px;
}

.plan-edit-add-task:hover {
    border-color: var(--primary-color);
    background: var(--overlay-gradient);
}

.plan-edit-add-task i {
    color: var(--primary-color);
    font-size: 16px;
}

.plan-edit-add-task span {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.plan-edit-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 24px;
    position: sticky;
    bottom: 0;
    background: white;
}

.plan-edit-actions .btn-primary,
.plan-edit-actions .btn-secondary {
    flex: 0 0 auto;
    margin: 0;
}

/* Адаптивность для редактирования плана */
@media (max-width: 768px) {
    .plan-edit-modal {
        max-width: 98vw;
        max-height: 98vh;
        width: 98vw;
        height: 98vh;
        margin: 0;
    }
    
    .plan-edit-milestone {
        padding: 16px;
    }
    
    .plan-edit-milestone-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .plan-edit-milestone-title {
        font-size: 16px;
    }
    
    .plan-edit-milestone-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .plan-edit-milestone-deadline {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .plan-edit-milestone-deadline input {
        width: 100%;
    }
    
    .plan-edit-task-item {
        flex-direction: column;
        gap: 8px;
    }
    
    .plan-edit-task-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .plan-edit-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .plan-edit-actions .btn-primary,
    .plan-edit-actions .btn-secondary {
        width: 100%;
    }
}

/* ====================================
   ДНЕВНИК ЦЕЛИ
   ==================================== */

/* Swiper стили для дневника */
.diary-entry .swiper {
    width: 100%;
    height: 300px;
    margin: 16px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.diary-entry .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}

.diary-entry .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.diary-entry .swiper-slide video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.diary-entry .swiper-zoom-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diary-entry .swiper-pagination {
    position: relative;
    margin-top: 12px;
}

.diary-entry .swiper-button-next,
.diary-entry .swiper-button-prev {
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin-top: -20px;
}

.diary-entry .swiper-button-next:after,
.diary-entry .swiper-button-prev:after {
    font-size: 16px;
}

.diary-entry .swiper-button-next {
    right: 10px;
}

.diary-entry .swiper-button-prev {
    left: 10px;
}

.diary-container {
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.diary-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.diary-header h3 {
    margin: 0 0 16px 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.diary-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.diary-filter select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 150px;
}

.diary-entries {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

.diary-entry {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 24px;
    border-radius: var(--radius-xl);
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    border-left: 6px solid var(--primary-color);
    transition: all var(--transition-base);
    position: relative;
}

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

.diary-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 16px;
}

.diary-entry-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.diary-entry-date {
    font-size: 14px;
    color: var(--text-muted);
    white-space: nowrap;
}

.diary-entry-milestone {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.diary-entry-content {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    white-space: pre-wrap;
}

.diary-entry-mood {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.diary-entry-mood .mood-icon {
    font-size: 20px;
}

.diary-entry-mood .mood-text {
    font-size: 14px;
    color: var(--text-muted);
}

.diary-entry-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.diary-entry-actions .btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Модальное окно дневника */
.diary-modal {
    max-width: 95vw;
    max-height: 95vh;
    width: 95vw;
    height: 95vh;
    overflow-y: auto;
    margin: 0;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.diary-modal .modal-body {
    padding: 32px;
    max-height: calc(95vh - 120px);
    overflow-y: auto;
}

.diary-modal .modal-header {
    padding: 24px 32px 16px 32px;
    border-bottom: 1px solid var(--border-color);
}

.diary-modal .modal-footer {
    padding: 16px 32px 24px 32px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.mood-selector {
    display: flex;
    gap: 12px;
    align-items: center;
    box-sizing: border-box;
}

.mood-selector input[type="radio"] {
    display: none;
}

.mood-option {
    display: inline-block;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
    border: 2px solid transparent;
}

.mood-option:hover {
    background: var(--bg-secondary);
    transform: scale(1.1);
}

.mood-selector input[type="radio"]:checked + .mood-option {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.15);
}

/* Пустое состояние дневника */
.diary-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.diary-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.diary-empty h4 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.diary-empty p {
    font-size: 16px;
    margin-bottom: 24px;
}

/* Фильтрация записей */
.diary-entries.filtered .diary-entry {
    display: none;
}

.diary-entries.filtered .diary-entry.visible {
    display: block;
}

/* Вложения в дневнике */
.attachments-container {
    margin-top: 8px;
}

.attachments-preview {
    margin-bottom: 16px;
}

.attachments-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.attachment-buttons {
    display: flex;
    gap: 8px;
}

.attachment-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid var(--border-color);
}

.attachment-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.attachment-btn i {
    font-size: 16px;
}

.attachments-list {
    margin-top: 16px;
}

.attachment-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
}

.attachment-icon {
    font-size: 20px;
    margin-right: 12px;
    min-width: 24px;
}

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

.attachment-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    word-break: break-word;
}

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

.attachment-progress {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.attachment-progress-bar {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
    width: 0%;
}

.attachment-actions {
    display: flex;
    gap: 8px;
    margin-left: 12px;
}

.attachment-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.attachment-remove:hover {
    background: var(--error-color);
    color: white;
}

/* Отображение вложений в записях дневника */
.diary-entry-attachments {
    margin-top: 16px;
}

.diary-attachment {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-right: 8px;
    margin-bottom: 8px;
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
    box-sizing: border-box;
    width: 100%;
}

.diary-attachment:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.diary-attachment-icon {
    margin-right: 6px;
    font-size: 16px;
}

.diary-attachment-name {
    font-size: 14px;
    font-weight: 500;
    width: calc(100% - 20px);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Адаптивность для дневника */
@media (max-width: 768px) {
    .diary-container {
        padding: 16px;
    }
    
    .diary-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .diary-filter {
        width: 100%;
    }
    
    .diary-filter select {
        width: 100%;
    }
    
    .diary-entry {
        padding: 16px;
    }
    
    .diary-entry-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .diary-entry-title {
        font-size: 18px;
    }
    
    .mood-selector {
        justify-content: center;
    }
    
    .diary-modal {
        max-width: 98vw;
        max-height: 98vh;
        width: 98vw;
        height: 98vh;
        margin: 0;
    }
    
    .attachments-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .attachment-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .attachment-btn {
        width: 36px;
        height: 36px;
    }
    
    .attachment-item {
        padding: 8px;
    }
    
    .attachment-actions {
        margin-left: 8px;
    }
    
    .task-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-task-diary {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
}

#attachmentsList>div {
    width: 120px;
    height: 90px;
    display: inline-block;
    /* float: left; */
    cursor: pointer;
    margin-right: 7px;
    position: relative;
    /* margin-bottom: 15px; */
    max-height: 100px;
    aspect-ratio: 4 / 3;
    /* flex: 0 0 auto;*/
}

div#tabChat {
    height: calc(100vh - 150px); /* 70px padding-top + 80px padding-bottom */
    min-height: 0;
}