/* ============================================================
   GLPlanner — премиум-стиль
   Тёмная тема, изумрудные акценты, анимации
   ============================================================ */

:root {
    /* Цвета */
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-card: #1E293B;
    --bg-hover: #334155;
    --border: #334155;
    --border-light: #475569;

    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;

    --emerald: #10B981;
    --emerald-dark: #059669;
    --emerald-light: #6EE7B7;
    --gold: #D4AF37;
    --red: #EF4444;
    --orange: #F59E0B;
    --blue: #3B82F6;
    --purple: #8B5CF6;

    /* Размеры */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Тени */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 24px rgba(16,185,129,0.3);

    /* Анимации */
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--emerald);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--emerald-light);
}

/* ============================================================
   СТРАНИЦА ЛОГИНА
   ============================================================ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(ellipse at top, #1E293B 0%, #0F172A 60%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    font-size: 56px;
    line-height: 1;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

.logo-text {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

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

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    font-size: 16px;
    color: var(--text-primary);
    transition: all var(--transition);
    outline: none;
}

.form-group input:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    min-height: 52px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
    color: white;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

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

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

.error-message {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #FCA5A5;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    text-align: center;
    animation: shake 400ms;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============================================================
   ДАШБОРД
   ============================================================ */

.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 100px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    margin-bottom: 24px;
}

.topbar-greeting h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.topbar-greeting p {
    color: var(--text-secondary);
    font-size: 14px;
}

.topbar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: white;
    cursor: pointer;
    transition: transform var(--transition);
}

.topbar-avatar:hover {
    transform: scale(1.05);
}

/* Карточки */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    animation: fadeInUp 500ms cubic-bezier(0.4, 0, 0.2, 1) both;
    transition: all var(--transition);
}

.card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Погода и курс */
.info-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeInUp 500ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.info-card:nth-child(1) { animation-delay: 0ms; }
.info-card:nth-child(2) { animation-delay: 100ms; }

.info-icon {
    font-size: 28px;
    line-height: 1;
}

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

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

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

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

/* Совет дня от коуча */
.coach-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    animation: fadeInUp 500ms cubic-bezier(0.4, 0, 0.2, 1) 200ms both;
    position: relative;
    overflow: hidden;
}

.coach-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--emerald), transparent);
    animation: shimmer 2s infinite;
}

.coach-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.coach-icon {
    font-size: 24px;
}

.coach-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--emerald);
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

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

/* Задачи */
.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    transition: all var(--transition);
    cursor: pointer;
}

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

.task-item:hover {
    padding-left: 4px;
}

.task-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    cursor: pointer;
}

.task-item:hover .task-checkbox {
    border-color: var(--emerald);
}

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

.task-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
}

.task-priority {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-critical { background: rgba(239,68,68,0.2); color: #FCA5A5; }
.priority-high     { background: rgba(245,158,11,0.2); color: #FCD34D; }
.priority-normal   { background: rgba(59,130,246,0.2); color: #93C5FD; }
.priority-low      { background: rgba(100,116,139,0.2); color: var(--text-secondary); }

/* Цель */
.goal-progress {
    margin-top: 12px;
}

.progress-bar {
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--emerald), var(--emerald-light));
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.goal-stats {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Встреча */
.event-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.05));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    animation: fadeInUp 500ms cubic-bezier(0.4, 0, 0.2, 1) 300ms both;
}

.event-timer {
    font-size: 28px;
    font-weight: 700;
    color: var(--purple);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
    margin: 8px 0;
}

/* Статистика */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    animation: fadeInUp 500ms cubic-bezier(0.4, 0, 0.2, 1) both;
    transition: all var(--transition);
}

.stat-card:hover {
    border-color: var(--emerald);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Нижняя навигация */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
    border-radius: var(--radius);
    min-width: 64px;
}

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

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

.nav-icon {
    font-size: 22px;
    line-height: 1;
}

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

/* Loader */
.loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--emerald);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
}

/* Утилиты */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-emerald { color: var(--emerald); }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }

/* ============================================================
   АНИМАЦИИ
   ============================================================ */

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

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

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

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ============================================================
   АДАПТИВ
   ============================================================ */

@media (max-width: 480px) {
    .dashboard { padding: 16px; }
    .topbar-greeting h1 { font-size: 20px; }
    .card { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .login-card { padding: 32px 24px; }
    .logo-text { font-size: 28px; }
}

@media (min-width: 768px) {
    .info-row { grid-template-columns: repeat(4, 1fr); }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================
   СТРАНИЦА ЗАДАЧ
   ============================================================ */

.filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 16px;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
    scrollbar-width: none;
}

.filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    font-family: inherit;
}

.filter-btn:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
    border-color: var(--emerald);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.task-card {
    padding: 16px;
    transition: all var(--transition);
}

.task-card.task-done {
    opacity: 0.5;
}

.task-card:hover {
    border-color: var(--border-light);
}

.task-checkbox.checked {
    background: var(--emerald);
    border-color: var(--emerald);
}

.task-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: 700;
}

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

.task-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.task-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all var(--transition);
    opacity: 0;
    flex-shrink: 0;
}

.task-card:hover .task-delete {
    opacity: 1;
}

.task-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
}

/* ============================================================
   МОДАЛКА
   ============================================================ */

.modal-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: flex-end;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 200ms;
    padding: 0;
}

.modal {
    background: var(--bg-card);
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 300ms cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all var(--transition);
    font-family: inherit;
}

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

.modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    position: sticky;
    bottom: 0;
}

.modal-footer .btn {
    flex: 1;
}

/* Textarea и Select */
.form-group textarea,
.form-group select {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    font-size: 16px;
    color: var(--text-primary);
    transition: all var(--transition);
    outline: none;
    font-family: inherit;
    resize: vertical;
}

.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 44px;
}

.form-group textarea {
    min-height: 80px;
}

/* Кнопка secondary */
.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    transform: translateY(-1px);
}

/* Анимация модалки */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Планшет и десктоп */
@media (min-width: 768px) {
    .modal-overlay {
        align-items: center;
        padding: 20px;
    }

    .modal {
        border-radius: var(--radius-xl);
        max-height: 85vh;
    }
}

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

/* Mood picker */
.mood-picker {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.mood-btn {
    flex: 1;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 8px;
    font-size: 24px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    line-height: 1;
}

.mood-btn:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.mood-btn.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.1));
    border-color: var(--emerald);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
    transform: scale(1.05);
}

/* Превью записи */
.entry-preview {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.entry-mood-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.entry-chip {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.entry-block {
    border-left: 3px solid var(--emerald);
    padding-left: 12px;
}

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

.entry-block > div:last-child {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* История */
.history-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    transition: all var(--transition);
}

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

.history-item:hover {
    padding-left: 4px;
}

.history-date {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.history-mood {
    font-size: 20px;
}

.history-types {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.history-chip {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============================================================
   ИИ-КОУЧ
   ============================================================ */

.insight-card {
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
}

.insight-card.insight-high {
    border-left: 4px solid var(--red);
}

.insight-card.insight-normal {
    border-left: 4px solid var(--orange);
}

.insight-card.insight-low {
    border-left: 4px solid var(--blue);
}

.insight-card.insight-read {
    opacity: 0.6;
}

.insight-card.insight-dismissed {
    opacity: 0.3;
}

.insight-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.insight-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

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

.insight-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

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

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

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

.insight-action-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.insight-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

/* Toast уведомления */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card);
    border: 1px solid var(--emerald);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(16, 185, 129, 0.3);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 90vw;
    text-align: center;
}

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

/* ============================================================
   МЕНЮ-СЕТКА (6 кнопок-разделов)
   ============================================================ */

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 24px;
    padding-bottom: 20px;
}

.menu-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all var(--transition);
    animation: fadeInUp 500ms cubic-bezier(0.4, 0, 0.2, 1) both;
    position: relative;
    overflow: hidden;
    min-height: 130px;
}

.menu-card:nth-child(1) { animation-delay: 0ms; }
.menu-card:nth-child(2) { animation-delay: 60ms; }
.menu-card:nth-child(3) { animation-delay: 120ms; }
.menu-card:nth-child(4) { animation-delay: 180ms; }
.menu-card:nth-child(5) { animation-delay: 240ms; }
.menu-card:nth-child(6) { animation-delay: 300ms; }

.menu-card:hover {
    border-color: var(--emerald);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 20px rgba(16, 185, 129, 0.15);
}

.menu-card:active {
    transform: translateY(-1px);
}

.menu-icon {
    font-size: 32px;
    line-height: 1;
    margin-bottom: 4px;
}

.menu-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.menu-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Карточка коуча — особенная */
.menu-card-coach {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(5, 150, 105, 0.04));
    border-color: rgba(16, 185, 129, 0.35);
}

.menu-card-coach:hover {
    border-color: var(--emerald);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 24px rgba(16, 185, 129, 0.3);
}

.menu-card-coach .menu-title {
    color: var(--emerald-light);
}

/* Карточка «Пройдите тест» — яркая */
.menu-card-test {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(212, 175, 55, 0.05));
    border-color: rgba(212, 175, 55, 0.5);
    animation: fadeInUp 500ms cubic-bezier(0.4, 0, 0.2, 1) 180ms both,
               pulseGold 2s ease-in-out infinite;
}

.menu-card-test .menu-title {
    color: var(--gold);
}

.menu-card-test::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    animation: shimmer 2s infinite;
}

@keyframes pulseGold {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(212, 175, 55, 0);
    }
}

/* На широких экранах — 3 колонки */
@media (min-width: 600px) {
    .menu-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 900px) {
    .menu-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    .menu-card {
        padding: 24px 20px;
        min-height: 150px;
    }
    .menu-icon {
        font-size: 40px;
    }
    .menu-title {
        font-size: 18px;
    }
}

/* ============================================================
   КАЛЕНДАРЬ
   ============================================================ */

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 8px 0;
}

.cal-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.cal-nav-btn:hover {
    border-color: var(--emerald);
    color: var(--emerald);
}

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

.cal-nav-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 16px;
}

.cal-cell {
    aspect-ratio: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 4px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    font-family: inherit;
    color: var(--text-primary);
    min-height: 50px;
}

.cal-cell:hover {
    border-color: var(--border-light);
    transform: scale(1.05);
}

.cal-cell-empty {
    background: transparent;
    border: none;
    cursor: default;
}

.cal-cell-empty:hover {
    transform: none;
}

.cal-today {
    border-color: var(--emerald);
    background: rgba(16, 185, 129, 0.1);
}

.cal-today .cal-day-num {
    color: var(--emerald);
    font-weight: 800;
}

.cal-selected {
    border-color: var(--emerald);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.1));
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.cal-day-num {
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
}

.cal-dots {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 6px;
}

.cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
}

.cal-dot-task { background: var(--emerald); }
.cal-dot-event { background: var(--purple); }
.cal-dot-journal { background: var(--gold); }

/* Легенда */
.cal-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-task { background: var(--emerald); }
.legend-event { background: var(--purple); }
.legend-journal { background: var(--gold); }

/* Блок дня */
.day-block {
    margin-top: 16px;
}

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

.day-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

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

.day-item-title {
    flex: 1;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.day-item-time {
    color: var(--text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

@media (max-width: 380px) {
    .cal-cell {
        min-height: 44px;
        padding: 4px 2px;
    }
    .cal-day-num {
        font-size: 13px;
    }
    .cal-dot {
        width: 4px;
        height: 4px;
    }
}

/* ============================================================
   ДЕНЬ ПО ЧАСАМ (тайм-блокинг)
   ============================================================ */

.hour-slot {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    min-height: 60px;
    transition: all var(--transition);
}

.hour-slot-active {
    background: rgba(16, 185, 129, 0.03);
}

.hour-slot-now {
    background: rgba(16, 185, 129, 0.08);
    border-left: 3px solid var(--emerald);
    margin-left: -3px;
    padding-left: 3px;
}

.hour-slot-now .hour-label {
    color: var(--emerald);
    font-weight: 700;
}

.hour-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    padding-top: 4px;
    text-align: right;
}

.hour-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 40px;
}

.hour-add-btn {
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    align-self: flex-start;
    opacity: 0;
}

.hour-slot:hover .hour-add-btn {
    opacity: 1;
}

.hour-add-btn:hover {
    border-color: var(--emerald);
    color: var(--emerald);
    background: rgba(16, 185, 129, 0.05);
}

/* Элементы в слоте */
.slot-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
    animation: fadeInUp 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.slot-item:hover {
    border-color: var(--border-light);
    transform: translateX(2px);
}

.slot-item-done {
    opacity: 0.5;
}

.slot-item-event {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(139, 92, 246, 0.03));
    border-color: rgba(139, 92, 246, 0.3);
}

.slot-event-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.slot-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    flex-shrink: 0;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot-checkbox:hover {
    border-color: var(--emerald);
}

.slot-checkbox.checked {
    background: var(--emerald);
    border-color: var(--emerald);
}

.slot-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: 700;
}

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

.slot-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slot-title-done {
    text-decoration: line-through;
    color: var(--text-muted);
}

.slot-meta {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.slot-meta .task-priority {
    font-size: 10px;
    padding: 1px 6px;
}

/* ============================================================
   ЦЕЛИ
   ============================================================ */

.goal-card {
    padding: 20px;
}

.goal-card-header {
    display: flex;
    gap: 14px;
    margin-bottom: 12px;
}

.goal-icon {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}

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

.goal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 6px;
}

.goal-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.goal-period {
    background: var(--bg-primary);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.goal-desc {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

/* План от ИИ */
.plan-section {
    margin-bottom: 20px;
}

.plan-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--emerald);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.plan-item {
    padding: 10px 12px;
    background: var(--bg-primary);
    border-left: 3px solid var(--emerald);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.plan-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.plan-item-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

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

.plan-task {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.plan-task:last-child {
    border-bottom: none;
}

.plan-task-date {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

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

.journal-textarea {
    width: 100%;
    min-height: 300px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: all var(--transition);
}

.journal-textarea:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.journal-textarea::placeholder {
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.6;
}

.journal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.journal-actions .btn {
    width: 100%;
}

.success-message {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--emerald-light);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    text-align: center;
}

/* История дневника */
.journal-history-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
}

.journal-history-item:last-child {
    border-bottom: none;
}

.journal-history-item:hover {
    padding-left: 6px;
    background: rgba(16, 185, 129, 0.03);
}

.journal-history-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--emerald);
    margin-bottom: 4px;
}

.journal-history-preview {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   КОУЧ — ОНБОРДИНГ
   ============================================================ */

.coach-test-page {
    background: radial-gradient(ellipse at top, #1E293B 0%, #0F172A 60%);
}

.test-progress {
    margin-bottom: 24px;
}

.test-progress-bar {
    height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.test-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--emerald), var(--emerald-light));
    border-radius: 2px;
    transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.test-progress-text {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.test-screen {
    animation: fadeInUp 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.test-hero {
    text-align: center;
    margin-bottom: 32px;
    padding: 20px 0;
}

.test-hero-icon {
    font-size: 64px;
    line-height: 1;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

.test-hero h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.3;
}

.test-hero-sub {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

.test-input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    font-size: 16px;
    color: var(--text-primary);
    transition: all var(--transition);
    outline: none;
    font-family: inherit;
}

.test-input:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.test-input::placeholder {
    color: var(--text-muted);
}

/* Вопросы */
.question-block {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.question-num {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
    color: white;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.question-text {
    flex: 1;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    padding-top: 8px;
}

.test-nav {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.test-nav .btn {
    flex: 1;
}

/* Колесо баланса */
.wheel-item {
    margin-bottom: 20px;
}

.wheel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

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

.wheel-name {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.wheel-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--emerald);
    min-width: 30px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.wheel-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-primary);
    outline: none;
    cursor: pointer;
}

.wheel-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.5);
    transition: transform var(--transition);
}

.wheel-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.wheel-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.5);
}

/* ============================================================
   ЧАТ С КОУЧЕМ
   ============================================================ */

.chat-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-primary);
}

.chat-page #content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Шапка */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.chat-back {
    font-size: 28px;
    color: var(--text-secondary);
    text-decoration: none;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all var(--transition);
}

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

.chat-header-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.chat-coach-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
}

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

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

.chat-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all var(--transition);
    font-family: inherit;
}

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

/* Меню */
.chat-menu {
    position: absolute;
    top: 60px;
    right: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
    animation: fadeIn 150ms;
}

.chat-menu-item {
    display: block;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    text-align: left;
    padding: 12px 16px;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

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

/* Совет дня */
.advice-banner {
    margin: 12px 16px 0;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius);
    padding: 14px;
    animation: fadeInUp 400ms;
    flex-shrink: 0;
}

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

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

.advice-label {
    flex: 1;
    font-size: 12px;
    font-weight: 700;
    color: var(--emerald);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.advice-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    font-family: inherit;
}

.advice-content {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* Чат-сообщения */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.chat-welcome {
    text-align: center;
    padding: 40px 20px;
    animation: fadeInUp 600ms;
}

.chat-welcome-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

.chat-welcome-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.chat-welcome-text {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

.chat-msg {
    display: flex;
    max-width: 85%;
    animation: fadeInUp 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-msg-user {
    align-self: flex-end;
}

.chat-msg-assistant {
    align-self: flex-start;
}

.chat-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.chat-msg-user .chat-bubble {
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.chat-msg-assistant .chat-bubble {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 6px;
}

/* Индикатор набора */
.chat-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 16px 18px;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Поле ввода */
.chat-input-area {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 6px 6px 6px 16px;
    transition: all var(--transition);
}

.chat-input-wrap:focus-within {
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    padding: 8px 0;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.5);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

/* ============================================================
   ИСПРАВЛЕНИЕ: отступ под нижнюю навигацию
   ============================================================ */

/* Все страницы с bottom-nav получают отступ снизу */
body:has(.bottom-nav) .dashboard {
    padding-bottom: 100px;
}

/* Для чата — отдельное правило (там нет .dashboard) */
.chat-page #content {
    padding-bottom: 0;
}

.chat-page .chat-messages {
    padding-bottom: 20px;
}

/* Для страницы «Сегодня» и других — увеличенный отступ */
.dashboard #content {
    padding-bottom: 20px;
}

/* Финальная кнопка внизу страницы всегда видна */
.dashboard > #content > *:last-child {
    margin-bottom: 20px;
}

/* Кнопки в конце формы */
.dashboard a.btn:last-of-type,
.dashboard button.btn:last-of-type {
    margin-bottom: 20px;
}

/* ============================================================
   ЧАТ: поле ввода не перекрывается
   ============================================================ */

.chat-page .chat-input-area {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

/* На странице чата — убираем нижнюю навигацию, если она есть */
.chat-page .bottom-nav {
    display: none !important;
}

/* Дашборд чата: чуть больше отступ */
.chat-page .chat-messages {
    padding-bottom: 8px;
}

/* ============================================================
   ЧАТ: ИСПРАВЛЕНИЕ ВЫСОТЫ (учитываем браузерную панель)
   ============================================================ */

/* Основной контейнер чата — на всю высоту видимой области */
.chat-page {
    height: 100vh;
    height: 100dvh; /* динамическая высота для мобильных */
    overflow: hidden;
}

.chat-page #content {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Поле ввода — всегда внизу и видно */
.chat-page .chat-input-area {
    padding: 12px 16px 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
    background: rgba(30, 41, 59, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 5;
}

/* Сообщения — скроллятся, но не перекрывают поле */
.chat-page .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 8px;
    min-height: 0;
}

/* Совет дня — не растягивается */
.chat-page .advice-banner {
    flex-shrink: 0;
}

/* Шапка — фиксированная */
.chat-page .chat-header {
    flex-shrink: 0;
}

/* Поле ввода — нормальная высота */
.chat-page .chat-input-wrap {
    min-height: 48px;
}

.chat-page .chat-input {
    min-height: 32px;
    padding: 8px 0;
}

/* Кнопка отправки не съезжает */
.chat-page .chat-send-btn {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

/* ============================================================
   КОНТАКТЫ
   ============================================================ */

.contact-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    transition: all var(--transition);
    animation: fadeInUp 400ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.contact-card:hover {
    border-color: var(--emerald);
    transform: translateX(2px);
}

.contact-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

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

.contact-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

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

.contact-importance {
    font-size: 14px;
    flex-shrink: 0;
}

.contact-stage {
    font-size: 12px;
    color: var(--emerald);
    margin-bottom: 4px;
}

.contact-phone {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

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

.contact-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.contact-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all var(--transition);
    font-family: inherit;
}

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

.contact-action-btn[data-action="delete"]:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
}

/* ============================================================
   КНОПКА ВЫХОДА
   ============================================================ */

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

.logout-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #FCA5A5;
    font-size: 20px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    color: #FEE2E2;
    transform: scale(1.05);
}

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

/* ============================================================
   КРАСИВАЯ КНОПКА ВЫХОДА
   ============================================================ */

.logout-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.1));
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #FCA5A5;
    font-size: 20px;
    cursor: pointer;
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

.logout-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.4), rgba(220, 38, 38, 0.2));
    opacity: 0;
    transition: opacity 300ms;
}

.logout-btn:hover {
    border-color: rgba(239, 68, 68, 0.6);
    color: #FEE2E2;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35), 0 0 16px rgba(239, 68, 68, 0.25);
}

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

.logout-btn:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.logout-btn svg {
    width: 20px;
    height: 20px;
    position: relative;
    z-index: 1;
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.logout-btn:hover svg {
    transform: translateX(2px);
}

/* Аватар рядом с кнопкой — чуть меньше */
.topbar-actions .topbar-avatar {
    width: 44px;
    height: 44px;
    font-size: 16px;
}

/* ============================================================
   ИСПРАВЛЕНИЕ: кнопка topbar-avatar
   ============================================================ */

button.topbar-avatar {
    padding: 0;
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: white;
    font-weight: 700;
}

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

/* Убеждаемся, что контейнер topbar не ломается */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 0;
    margin-bottom: 24px;
    flex-wrap: nowrap;
}

.topbar-greeting {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.topbar-greeting h1 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
