/* Переменные цветов */
:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --secondary: #2ecc71;
    --danger: #e74c3c;
    --warning: #f39c12;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --gray: #95a5a6;
    --gray-light: #bdc3c7;
}

/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Навигационная панель */
.navbar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 0;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
}

.nav-brand:hover {
    color: white;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
}

.nav-link.active {
    background-color: rgba(255,255,255,0.2);
    font-weight: 600;
}

.nav-link-button {
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.nav-logout-form {
    margin: 0;
}

.nav-user-menu {
    position: relative;
}

.nav-user-trigger {
    list-style: none;
    cursor: pointer;
    user-select: none;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-user-trigger::-webkit-details-marker {
    display: none;
}

.nav-user-menu[open] .nav-user-trigger {
    background-color: rgba(255,255,255,0.16);
}

.nav-user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.55rem);
    min-width: 180px;
    padding: 0.45rem;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 14px 30px rgba(44, 62, 80, 0.18);
    border: 1px solid rgba(52, 152, 219, 0.12);
    z-index: 20;
}

.nav-dropdown-action {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--danger);
    font: inherit;
    text-align: left;
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
}

.nav-dropdown-action:hover {
    background: #fff1f0;
}

/* Основной контейнер */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 1rem;
    gap: 1rem;
}

.main-container-full {
    max-width: 880px;
}

/* Боковая панель */
.sidebar {
    width: 300px;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section h3 {
    color: var(--dark);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.topic-list {
    list-style: none;
}

.topic-item {
    padding: 0;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-bottom: 0.25rem;
}

.topic-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    width: 100%;
    transition: background-color 0.3s ease;
}

.topic-link:hover {
    background-color: var(--light);
    text-decoration: none;
}

.topic-item.active .topic-link {
    background-color: var(--primary);
    color: white;
}

.stats {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background-color: var(--light);
    border-radius: 8px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    color: var(--gray);
    font-size: 0.9rem;
}

/* Область основного контента */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.content:only-child {
    width: 100%;
}

/* Карточки */
.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Приветственный баннер */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    text-align: center;
}

.welcome-banner h1 {
    margin-bottom: 0.5rem;
}

/* Сетка контента */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.content-grid .card:nth-child(3) {
    grid-column: 1 / -1;
}


/* Кнопки */
.btn-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.btn-link:hover {
    color: var(--primary-dark);
}

.btn-primary, .btn-secondary, .btn-outline, .btn-habit-complete {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

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

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

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

.btn-secondary:hover {
    background-color: #27ae60;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--gray);
    color: var(--dark);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-habit-complete {
    background-color: var(--secondary);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-habit-complete:hover {
    background-color: #27ae60;
}

.btn-habit-complete:disabled {
    background-color: var(--gray-light);
    cursor: not-allowed;
    opacity: 0.8;
}

.quote-card {
    position: relative;
    padding: 1.75rem;
    border-radius: 20px;
    background:
        radial-gradient(circle at top right, rgba(246, 196, 83, 0.2), transparent 35%),
        linear-gradient(135deg, #fff8e8 0%, #ffffff 100%);
    border: 1px solid rgba(212, 175, 55, 0.18);
    box-shadow: 0 16px 32px rgba(31, 41, 55, 0.08);
    overflow: hidden;
}

.quote-card::before {
    content: "\201C";
    position: absolute;
    top: 0.5rem;
    left: 1rem;
    font-size: 4.5rem;
    line-height: 1;
    color: rgba(212, 175, 55, 0.2);
    font-family: Georgia, serif;
}

.quote-card-text {
    position: relative;
    margin: 0;
    padding-left: 1.25rem;
    color: #2f3640;
    font-size: 1.1rem;
    line-height: 1.7;
    font-style: italic;
}

.quote-card-author {
    margin: 1rem 0 0;
    color: #8c6a1a;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.quote-card-author::before {
    content: "\2014  ";
}

.quote-card-empty {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .habits-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        order: 2;
    }

    .content {
        order: 1;
    }

    .nav-menu {
        gap: 0.5rem;
    }

    .nav-link span {
        display: none;
    }
}

/* Стили для новых страниц */

/* Заголовок страницы */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light);
}

.page-header h1 {
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Фильтры */
.filters {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

.filter-group select {
    padding: 0.5rem;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    background-color: white;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

.form-group input {
    padding: 0.75rem;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

.btn-task-edit, .btn-task-delete, .btn-habit-edit, .btn-habit-delete {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-task-edit:hover, .btn-habit-edit:hover {
    color: var(--primary);
    background-color: rgba(52, 152, 219, 0.1);
}

.btn-task-delete:hover, .btn-habit-delete:hover {
    color: var(--danger);
    background-color: rgba(231, 76, 60, 0.1);
}

/* Состояние выполнено */
.task-item.completed .task-title {
    text-decoration: line-through;
    color: var(--gray);
}

.btn-habit-complete.completed {
    background-color: var(--gray);
    cursor: not-allowed;
}

.btn-habit-complete.completed:hover {
    background-color: var(--gray);
}

/* Основные стили для страницы формы */
.form-page {
    width: 100%;
    padding: 20px;
    background-color: #f5f5f5;
    min-height: calc(100vh - 60px);
}

.form-container {
    max-width: 90%;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.form-header h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
}

.form-description {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

/* Стили для формы */
.item-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-section h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* Стили для кнопок */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid #ddd;
    color: #333;
}

/* Стили для страниц списков */
.list-page {
    width: 100%;
    padding: 0;
}

.list-page .sidebar {
    display: none;
}

.list-page .content {
    width: 100%;
    max-width: 100%;
    padding: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.page-header h1 {
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.list-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Сетка тем */
.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.theme-card {
    padding: 1.5rem;
    border-radius: 12px;
    background: var(--light);
    border: 1px solid var(--gray-light);
    transition: all 0.3s ease;
}

.theme-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.theme-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    min-width: 0;
}

.theme-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.theme-header h3 {
    margin: 0;
    color: var(--dark);
    font-size: 1.2rem;
    flex: 1;
    min-width: 0;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.theme-stats .stat {
    padding: 0.25rem 0.75rem;
    background: white;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--gray);
    font-weight: 600;
}

.theme-actions {
    display: flex;
    gap: 0.5rem;
}

/* Кнопки */
.btn-danger {
    background-color: var(--danger);
    color: white;
}

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* Empty state */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 2rem;
    color: var(--gray);
}

.empty-state i {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin-bottom: 2rem;
}

/* Фильтры (общие) */
.filters {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

.filter-group select {
    padding: 0.5rem;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    background-color: white;
    font-size: 0.9rem;
}

/* Адаптивность для списков */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .themes-grid,
    .habits-grid {
        grid-template-columns: 1fr;
    }

    .task-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .task-actions {
        justify-content: flex-end;
    }

    .filters {
        flex-direction: column;
        gap: 1rem;
    }

    .habit-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .page-header,
    .list-container {
        padding: 1rem;
    }

    .task-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .theme-actions,
    .habit-actions {
        flex-direction: column;
    }

    .theme-header h3 {
        max-width: 150px;
    }
}

/* Стили для страницы сообщений */
.message-page {
    width: 100%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
}

.message-page .sidebar {
    display: none;
}

.message-page .content {
    width: 100%;
    max-width: 100%;
    padding: 0;
}

.message-container {
    max-width: 500px;
    margin: 2rem auto;
    background: white;
    border-radius: 16px;
    padding: 3rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    text-align: center;
    animation: slideUp 0.6s ease-out;
}

.message-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.message-content h1 {
    color: var(--dark);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.message-text {
    color: var(--gray);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.message-details {
    background: var(--light);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    text-align: left;
}

.message-details p {
    margin: 0;
    color: var(--dark);
    font-family: monospace;
    font-size: 0.9rem;
}

.message-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

/* Анимации */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Заголовок формы */
.form-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--light);
}

.form-icon-wrapper {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
}

.form-title h1 {
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-size: 2.2rem;
    text-align: center;
}

.form-title {
    text-align: center;
    align-self: center;
}

.form-description {
    color: var(--gray);
    font-size: 1.1rem;
    line-height: 1.5;
}

/* Улучшенные секции формы */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.section-header i {
    color: var(--primary);
    font-size: 1.2rem;
}

.section-header h3 {
    color: var(--dark);
    margin: 0;
    font-size: 1.3rem;
}

.form-section {
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 12px;
    border: 1px solid var(--light);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.form-section:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* Улучшенные поля формы */
.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.form-group label i {
    color: var(--primary);
    width: 16px;
}

.form-control {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--light);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
    transform: translateY(-1px);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 0.05rem;
    margin-bottom: 1rem;
    font-style: italic;
}

/* Улучшенный color picker */
.color-picker-container {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: start;
}

.color-picker {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0.75rem;
}

.color-option {
    position: relative;
}

.color-option input[type="radio"] {
    display: none;
}

.color-option label {
    display: block;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    margin: 0;
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.color-option label:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.color-option input[type="radio"]:checked + label {
    border-color: var(--dark);
    transform: scale(1.15);
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

.color-option input[type="radio"]:checked + label::after {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.color-option label.random-color-label {
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 1.1rem;
}

.color-option input[type="radio"]:checked + label.random-color-label {
    border-color: var(--dark);
    color: var(--dark);
}

/* Улучшенные кнопки действий */
.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--light);
}

.action-buttons {
    display: flex;
    gap: 1rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* Алерты */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    animation: slideDown 0.3s ease-out;
}

.alert-error {
    background: #ffeaea;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert i {
    font-size: 1.2rem;
}

.form-error {
    color: #b42318;
    background: #fef3f2;
    border: 1px solid #fecdca;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

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

/* Адаптивность для форм */
@media (max-width: 768px) {
    .message-container {
        margin: 1rem;
        padding: 2rem;
    }

    .form-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .form-icon-wrapper {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .form-title h1 {
        font-size: 1.8rem;
    }

    .color-picker-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .color-picker {
        grid-template-columns: repeat(4, 1fr);
    }

    .form-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .action-buttons {
        width: 100%;
        justify-content: space-between;
    }

    .btn {
        flex: 1;
        justify-content: center;
    }

    .progress-step::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .message-container {
        padding: 1.5rem;
    }

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

    .color-picker {
        grid-template-columns: repeat(3, 1fr);
    }

    .form-section {
        padding: 0.5rem;
    }

    .action-buttons {
        flex-direction: column;
    }
}

/* Стили для страницы задач */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tasks-pagination {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.tasks-pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tasks-page-btn {
    min-width: 42px;
}

.tasks-page-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
    pointer-events: none;
}

.tasks-page-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.tasks-pagination-info {
    font-size: 0.85rem;
    color: var(--gray);
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
    gap: 1rem;
}

.task-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
}

.task-item.high-priority {
    border-left-color: var(--danger);
}

.task-item.medium-priority {
    border-left-color: var(--warning);
}

.task-main {
    display: flex;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.task-checkbox {
    margin-top: 0.25rem;
    flex-shrink: 0;
    position: relative;
    width: 20px;
    height: 20px;
}

.task-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid var(--gray-light);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    margin: 0;
}

.task-checkbox input[type="checkbox"]:checked {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

.task-checkbox input[type="checkbox"]:checked::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
    line-height: 1;
}

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

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.task-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
    flex: 1;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

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

.task-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 4px;
}

.task-theme {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-priority {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.task-priority.high {
    background-color: rgba(231, 76, 60, 0.1);
    color: var(--danger);
}

.task-priority.medium {
    background-color: rgba(243, 156, 18, 0.1);
    color: var(--warning);
}

.task-priority.low {
    background-color: rgba(46, 204, 113, 0.1);
    color: var(--secondary);
}

.task-due-date {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background-color: rgba(52, 152, 219, 0.1);
    color: var(--primary);
}

.task-due-date.overdue {
    background-color: rgba(231, 76, 60, 0.1);
    color: var(--danger);
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
    flex-shrink: 0;
}

/* Стили для фильтров задач */
.filters-container {
    display: flex;
    gap: 2rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-group label {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
    white-space: nowrap;
    margin: 0;
}

.filter-group .form-control {
    padding: 0.5rem 1rem;
    border: 2px solid var(--light);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
}

.filter-group .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Адаптивность для фильтров задач */
@media (max-width: 768px) {
    .filters-container {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .filter-group .form-control {
        min-width: 100%;
        width: 100%;
    }

    .task-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .task-meta {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Отдельный layout фильтров для habits */
.habits-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem 1.25rem;
    align-items: end;
}

.habits-filters .filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
}

.habits-filters .filter-group label {
    white-space: normal;
}

.habits-filters .filter-group .form-control {
    min-width: 0;
    width: 100%;
}

.habits-filters .sort-order-buttons {
    width: 100%;
}

.habits-filters .btn-order span {
    display: inline;
}

@media (max-width: 480px) {
    .task-item {
        flex-direction: column;
        gap: 1rem;
    }

    .task-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }

    .task-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .task-theme {
        max-width: 120px;
    }
}

/* Стили для радио-кнопок тем */
.themes-radio-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.theme-radio-option {
    position: relative;
}

.theme-radio-input {
    display: none;
}

.theme-radio-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 2px solid var(--light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    font-weight: 500;
}

.theme-radio-label:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.theme-radio-input:checked + .theme-radio-label {
    border-color: var(--primary);
    background: rgba(52, 152, 219, 0.05);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.2);
}

.theme-color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.theme-name {
    font-size: 0.9rem;
    color: var(--dark);
}

/* Стили для радио-кнопок приоритета */
.priority-radio-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

.priority-radio-option {
    position: relative;
}

.priority-radio-input {
    display: none;
}

.priority-radio-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    border: 2px solid var(--light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    text-align: center;
    font-weight: 500;
}

.priority-radio-label:hover {
    border-color: var(--gray-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.priority-radio-input:checked + .priority-radio-label {
    border-color: var(--priority-color, var(--primary));
    background: linear-gradient(135deg, var(--light), white);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    color: var(--dark);
}

.priority-radio-label i {
    font-size: 1.25rem;
    color: var(--priority-color, var(--gray));
    transition: color 0.3s ease;
}

.priority-radio-input:checked + .priority-radio-label i {
    color: var(--priority-color, var(--primary));
}

.priority-name {
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Адаптивность для радио-кнопок */
@media (max-width: 768px) {
    .themes-radio-container {
        grid-template-columns: 1fr;
    }

    .priority-radio-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .priority-radio-label {
        flex-direction: row;
        justify-content: flex-start;
        padding: 1rem;
    }

    .theme-radio-label {
        padding: 0.875rem;
    }
}

@media (max-width: 480px) {
    .priority-radio-label {
        padding: 0.875rem 0.75rem;
    }

    .theme-radio-label {
        padding: 0.75rem;
    }
}

/* Анимация при выборе */
@keyframes prioritySelect {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.priority-radio-input:checked + .priority-radio-label {
    animation: prioritySelect 0.3s ease;
}

.theme-radio-input:checked + .theme-radio-label[for="theme-none"] {
    border-color: #95a5a6;
    background: rgba(149, 165, 166, 0.05);
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.2);
}

.theme-radio-label[for="theme-none"]:hover {
    border-color: #95a5a6;
}

/* Секции расписания в форме привычек */
.schedule-config-block {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    border: 1px dashed var(--gray-light);
    border-radius: 10px;
    background: rgba(248, 249, 250, 0.6);
}

.schedule-config-block .form-group:last-child {
    margin-bottom: 0;
}

.schedule-config-block .form-hint {
    margin: 0;
}

/* Стили для главной страницы (dashboard) */
.dashboard {
    width: 100%;
}

/* Стили для списка задач на главной */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dashboard .task-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
}

.dashboard .task-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.dashboard .task-item.priority-high {
    border-left-color: var(--danger);
}

.dashboard .task-item.priority-medium {
    border-left-color: var(--warning);
}

.dashboard .task-item.priority-low {
    border-left-color: var(--secondary);
}

.dashboard .task-checkbox {
    position: relative;
    flex-shrink: 0;
}

.dashboard .task-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-light);
    border-radius: 4px;
    cursor: pointer;
    appearance: none;
    transition: all 0.3s ease;
}

.dashboard .task-checkbox input[type="checkbox"]:checked {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

.dashboard .task-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
}

.dashboard .task-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dashboard .task-title {
    font-weight: 600;
    color: var(--dark);
    font-size: 1rem;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.dashboard .task-description {
    font-size: 0.9rem;
    color: var(--gray);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: break-word;
}

.dashboard .task-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.dashboard .task-tag {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.dashboard .task-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.dashboard .task-tag::before {
    content: '●';
    font-size: 0.6rem;
    opacity: 0.8;
}

/* Стили для сетки привычек на главной */
.habits-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.habits-page-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.habit-card {
    padding: 1.25rem;
    background: var(--light);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.habit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.habit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.habit-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--dark);
}

.habit-streak {
    background: var(--secondary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.habit-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background-color: white;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 50px 50px;
    animation: moveStripes 2s linear infinite;
}

.habit-progress span {
    font-weight: 600;
    color: var(--dark);
    min-width: 40px;
    text-align: right;
}

.habit-actions {
    display: flex;
    justify-content: center;
}

/* Анимация для прогресс-бара */
@keyframes moveStripes {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 50px 0;
    }
}

/* Анимация для кнопки завершения задачи */
.task-checkbox input[type="checkbox"]:checked + label::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
}

.task-checkbox input[type="checkbox"]:checked {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

/* Анимация для появления элементов */
.task-item, .habit-card {
    animation: fadeInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.task-item:nth-child(1) { animation-delay: 0.1s; }
.task-item:nth-child(2) { animation-delay: 0.2s; }
.task-item:nth-child(3) { animation-delay: 0.3s; }
.task-item:nth-child(4) { animation-delay: 0.4s; }
.task-item:nth-child(5) { animation-delay: 0.5s; }

.habit-card:nth-child(1) { animation-delay: 0.1s; }
.habit-card:nth-child(2) { animation-delay: 0.2s; }

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

/* Адаптивность для главной страницы */
@media (max-width: 768px) {
    .habits-grid {
        grid-template-columns: 1fr;
    }

    .dashboard .task-item {
        flex-wrap: wrap;
    }

    .dashboard .task-actions {
        width: 100%;
        justify-content: flex-start;
        margin-top: 0.75rem;
    }

    .quote-card {
        padding: 1.5rem 1.25rem;
    }

    .quote-card-text {
        padding-left: 0.75rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .dashboard .task-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .dashboard .task-content {
        width: 100%;
    }

    .habit-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .habit-streak {
        align-self: flex-start;
    }

    .dashboard .task-description {
        -webkit-line-clamp: 3;
    }

    .dashboard .task-tag {
        max-width: 120px;
    }
}

/* Стили для пустого состояния на дашборде */
.dashboard .empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border: 2px dashed var(--gray-light);
    transition: all 0.3s ease;
}

.dashboard .empty-state:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.dashboard .empty-state p {
    color: var(--gray);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.dashboard .empty-state i {
    color: var(--gray);
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Стили для кнопки создания новой задачи */
.new-task {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.4s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    position: relative;
    overflow: hidden;
    border: none;
    cursor: pointer;
}

.new-task::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.7s ease;
}

.new-task:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
    color: white;
}

.new-task:hover::before {
    left: 100%;
}

.new-task:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.new-task i {
    font-size: 0.9rem;
    margin: 0;
    opacity: 1;
    transition: transform 0.3s ease;
}

.new-task:hover i {
    transform: rotate(90deg);
}

/* Анимация пульсации для привлечения внимания */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    }
    50% {
        box-shadow: 0 4px 25px rgba(52, 152, 219, 0.5);
    }
}

.empty-state .new-task {
    animation: pulse-glow 2s infinite;
}

/* Улучшенный пустой список задач */
.task-list .empty-state,
.habits-grid .empty-state {
    grid-column: 1 / -1;
    margin: 1rem 0;
}

/* Стили для пустого состояния в карточке привычек */
.habit-card.empty-habit-suggestion {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.05), rgba(46, 204, 113, 0.05));
    border: 2px dashed var(--gray-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Адаптивность для пустых состояний */
@media (max-width: 768px) {
    .dashboard .empty-state {
        padding: 2rem 1rem;
    }

    .dashboard .empty-state p {
        font-size: 1rem;
    }

    .new-task {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    .empty-state-illustration {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .dashboard .empty-state {
        padding: 1.5rem 1rem;
    }

    .new-task {
        width: 100%;
        justify-content: center;
    }

    .habit-card.empty-habit-suggestion {
        min-height: 180px;
    }
}

/* Стили для кнопок сортировки */
.sort-order-buttons {
    display: flex;
    gap: 8px;
    background: var(--light);
    padding: 4px;
    border-radius: 8px;
}

.btn-order {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray);
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    justify-content: center;
}

.btn-order:hover {
    background: rgba(52, 152, 219, 0.1);
    color: var(--primary);
}

.btn-order.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.btn-order i {
    font-size: 0.9rem;
}

.btn-order span {
    display: none;
}

@media (min-width: 768px) {
    .btn-order span {
        display: inline;
    }
}

@media (max-width: 480px) {
    .sort-order-buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn-order {
        width: 100%;
    }
}

/* Стили для времени создания задачи */
.task-created-date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: #f0f7ff;
    color: #2c5282;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid #bee3f8;
    transition: all 0.2s ease;
}

.task-created-date i {
    font-size: 0.7rem;
    opacity: 0.8;
}

.task-created-date:hover {
    background-color: #e6f2ff;
    border-color: #90cdf4;
}

/* Темная тема */
.dark-theme .task-created-date {
    background-color: #2d3748;
    color: #90cdf4;
    border-color: #4a5568;
}

.dark-theme .task-created-date:hover {
    background-color: #4a5568;
    border-color: #63b3ed;
}

.dark-theme .task-updated {
    background-color: #2d3748;
    color: #a0aec0;
}

.dark-theme .task-updated:hover {
    background-color: #4a5568;
    color: #cbd5e0;
}

/* Дополнительные адаптивные правки */
@media (max-width: 768px) {
    .task-created-date,
    .task-updated {
        font-size: 0.75rem;
        padding: 1px 6px;
    }

    .task-meta {
        gap: 4px;
    }
}

.task-description {
    font-size: 0.9rem;
    color: var(--gray);
    line-height: 1.4;
    margin-top: 0.25rem;
    word-break: break-word;        /* перенос длинных слов */
    overflow-wrap: break-word;     /* альтернативный перенос */
    hyphens: auto;                  /* расстановка переносов (если поддерживается) */
    display: -webkit-box;
    -webkit-line-clamp: 4;          /* количество видимых строк */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Обновленный дизайн блока привычек */
.habits-filters {
    padding: 1.1rem;
    background: linear-gradient(145deg, #ffffff, #f6f9fd);
    border: 1px solid rgba(52, 152, 219, 0.15);
    box-shadow: 0 10px 30px rgba(44, 62, 80, 0.08);
}

.habits-filters .filter-group label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5a6b7f;
}

.habits-filters .filter-group .form-control {
    min-height: 42px;
    border-radius: 10px;
    border: 1px solid #d4e3f1;
    background: #fbfdff;
}

.habits-filters .btn-order {
    min-height: 42px;
    border: 1px solid transparent;
}

.habits-filters .btn-order.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 6px 18px rgba(52, 152, 219, 0.28);
}

.habits-grid {
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.habits-page-grid {
    grid-template-columns: 1fr;
}

.habits-page-grid .habit-card {
    gap: 0.65rem;
    padding-bottom: 1rem;
}

.habits-page-grid .habit-actions {
    margin-top: auto;
}

.habits-page-grid .habit-card.no-progress {
    min-height: 220px;
}

.habits-page-grid .habit-progress {
    margin-top: 0.2rem;
}

.habit-card {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    min-height: 260px;
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid #dce8f3;
    background: linear-gradient(160deg, #ffffff 0%, #f6fbff 100%);
    box-shadow: 0 8px 20px rgba(31, 53, 72, 0.08);
    position: relative;
    overflow: hidden;
}

.habit-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.habit-card.is-completed::before {
    background: linear-gradient(90deg, #2ecc71, #27ae60);
}

.habit-card.is-archived::before {
    background: linear-gradient(90deg, #a2b3c0, #7f8c8d);
}

.habit-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 28px rgba(31, 53, 72, 0.14);
}

.habit-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.habit-main {
    min-width: 0;
}

.habit-title {
    margin: 0;
    font-size: 1.06rem;
    color: var(--dark);
    line-height: 1.3;
    word-break: break-word;
}

.habit-description {
    margin: 0.45rem 0 0;
    font-size: 0.89rem;
    color: #627587;
    line-height: 1.45;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.habit-streak {
    flex-shrink: 0;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(46, 204, 113, 0.14);
    color: #1f9150;
    font-size: 0.82rem;
    font-weight: 700;
}

.habit-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.habit-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.2;
}

.habit-chip i {
    font-size: 0.72rem;
}

.habit-chip-theme {
    max-width: 170px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.habit-chip-schedule {
    color: #1e5f95;
    background: rgba(52, 152, 219, 0.14);
    border: 1px solid rgba(52, 152, 219, 0.22);
}

.habit-chip-status {
    border: 1px solid transparent;
}

.habit-chip-status-done {
    color: #1f9150;
    background: rgba(46, 204, 113, 0.14);
    border-color: rgba(46, 204, 113, 0.25);
}

.habit-chip-status-archived {
    color: #5f6d79;
    background: rgba(149, 165, 166, 0.18);
    border-color: rgba(127, 140, 141, 0.25);
}

.habit-chip-period {
    color: #6a7582;
    background: #f3f6fa;
    border: 1px solid #d9e2ec;
    flex-basis: 100%;
}

.habit-progress {
    margin-top: auto;
    margin-bottom: 0;
}

.progress-bar {
    height: 10px;
    border-radius: 999px;
    background: #eaf1f7;
}

.progress-fill {
    border-radius: 999px;
}

.progress-fill::after {
    opacity: 0.5;
}

.habit-progress-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #4f6577;
    min-width: 48px;
}

.habit-actions {
    margin-top: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.habit-actions .btn-habit-edit,
.habit-actions .btn-habit-complete {
    flex: 1;
    border-radius: 10px;
    min-height: 40px;
    padding: 0.5rem 0.8rem;
    font-size: 0.84rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.habit-actions .btn-habit-edit {
    border: 1px solid #c9d9e8;
    background: #ffffff;
    color: #35526c;
}

.habit-actions .btn-habit-edit:hover {
    background: #f1f7fd;
    border-color: #9bc1e2;
    color: #204d74;
}

.habit-actions .btn-habit-complete {
    border: none;
    color: #fff;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    box-shadow: 0 7px 18px rgba(39, 174, 96, 0.24);
}

.habit-actions .btn-habit-complete:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(39, 174, 96, 0.3);
}

.habit-actions .btn-habit-complete.completed,
.habit-actions .btn-habit-complete[disabled] {
    background: #b5c2cd;
    box-shadow: none;
    color: #fff;
}

.habit-actions .btn-habit-delete {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid #efd1d1;
    color: #b44a4a;
    background: #fff7f7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.habit-actions .btn-habit-delete:hover {
    border-color: #e9b3b3;
    background: #ffeded;
    color: #9b2d2d;
}

.habit-actions-compact .btn-habit-edit {
    flex: 0 0 auto;
    min-width: 128px;
}

.dashboard .habits-grid .habit-card {
    min-height: 190px;
    padding: 0.85rem;
    gap: 0.65rem;
}

.dashboard .habits-grid .habit-card.no-progress {
    min-height: 158px;
}

.dashboard .habits-grid .habit-title {
    font-size: 0.98rem;
}

.dashboard .habits-grid .habit-progress {
    margin-top: 0;
}

.habit-actions-dashboard .btn-habit-edit,
.habit-actions-dashboard .btn-habit-complete {
    min-height: 36px;
    font-size: 0.8rem;
    padding: 0.4rem 0.7rem;
}

.alert {
    border-radius: 12px;
    padding: 0.95rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fff1f0;
    border: 1px solid #f2b8b5;
    color: #8b2f2b;
}

.btn {
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
}

.auth-shell {
    min-height: calc(100vh - 180px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0;
}

.auth-card {
    width: min(100%, 460px);
    background: linear-gradient(180deg, #ffffff 0%, #f6fbff 100%);
    border: 1px solid #dbeaf5;
    border-radius: 24px;
    box-shadow: 0 18px 45px rgba(41, 128, 185, 0.12);
    padding: 2rem;
}

.auth-card-header h1 {
    margin: 0.35rem 0 0.6rem;
    color: var(--dark);
}

.auth-card-header p {
    color: #5d6d7e;
    margin-bottom: 1.5rem;
}

.auth-eyebrow {
    display: inline-block;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(52, 152, 219, 0.12);
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-oauth {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.auth-oauth-after-form {
    margin-top: 1.15rem;
    padding-top: 1.1rem;
    border-top: 1px solid #dbeaf5;
}

.auth-oauth-btn {
    width: 100%;
    min-height: 58px;
    padding: 0.85rem 1rem;
    border: 1px solid #d7e4ef;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
    box-shadow: 0 10px 22px rgba(41, 128, 185, 0.08);
    color: #243746;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.auth-oauth-btn:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
    box-shadow: 0 14px 28px rgba(41, 128, 185, 0.12);
}

.auth-oauth-badge {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e3edf5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ea4335;
    font-size: 1rem;
}

.auth-oauth-hint {
    margin: 0;
    color: #5d6d7e;
    font-size: 0.92rem;
    text-align: center;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-weight: 600;
    color: var(--dark);
}

.auth-field input {
    border: 1px solid #c9d9e8;
    border-radius: 12px;
    padding: 0.95rem 1rem;
    font-size: 1rem;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.14);
}

.auth-note {
    display: flex;
    gap: 0.6rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: #eef8f2;
    border: 1px solid #cde9d7;
    color: #266341;
    font-size: 0.92rem;
}

.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.95rem 1.1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 1rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.auth-submit:hover {
    transform: translateY(-1px);
}

.auth-footer {
    margin-top: 1.2rem;
    color: #5d6d7e;
    text-align: center;
}

.auth-footer a {
    color: var(--primary-dark);
    font-weight: 700;
    text-decoration: none;
}

.stats-page {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.stats-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(46, 204, 113, 0.16), transparent 32%),
        radial-gradient(circle at bottom left, rgba(52, 152, 219, 0.18), transparent 30%),
        #ffffff;
}

.stats-page-header::after {
    content: "";
    position: absolute;
    inset: auto -80px -110px auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(52, 152, 219, 0.08);
    pointer-events: none;
}

.stats-page-heading h1 {
    color: var(--dark);
    margin-bottom: 0.35rem;
    font-size: 2rem;
}

.stats-page-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.45rem;
}

.stats-page-description {
    color: #5b6773;
    max-width: 620px;
}

.stats-page-controls {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: flex-end;
    min-width: 220px;
    position: relative;
    z-index: 1;
}

.stats-page-range-copy {
    color: #546271;
    font-size: 0.95rem;
}

.stats-range-filter {
    display: inline-flex;
    gap: 0.5rem;
    background: rgba(238, 245, 251, 0.9);
    padding: 0.4rem;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(52, 152, 219, 0.08);
}

.stats-range-link {
    text-decoration: none;
    color: var(--dark);
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.stats-range-link:hover {
    background: rgba(52, 152, 219, 0.12);
}

.stats-range-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 18px rgba(52, 152, 219, 0.25);
}

.stats-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
}

.stats-kpi-card {
    min-height: 188px;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    border: 1px solid #e4edf5;
}

.stats-kpi-card::after {
    content: "";
    position: absolute;
    inset: auto -28px -32px auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(52, 152, 219, 0.08);
}

.stats-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.stats-kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eff7ff, #f8fbff);
    color: var(--primary-dark);
    font-size: 1rem;
}

.stats-kpi-key {
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: #f2f7fb;
    color: #6a7a89;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.stats-kpi-card-success_rate .stats-kpi-icon,
.stats-kpi-card-active_habits .stats-kpi-icon,
.stats-kpi-card-due_today .stats-kpi-icon,
.stats-kpi-card-completed_today .stats-kpi-icon,
.stats-kpi-card-total_habits .stats-kpi-icon {
    background: linear-gradient(135deg, #eefbf3, #f6fffb);
    color: #1f8f57;
}

.stats-kpi-label {
    color: #697586;
    font-size: 0.95rem;
    position: relative;
    z-index: 1;
}

.stats-kpi-value {
    font-size: 2.15rem;
    line-height: 1.1;
    font-weight: 700;
    color: var(--dark);
    margin: 0.15rem 0 0.3rem;
    position: relative;
    z-index: 1;
}

.stats-kpi-hint {
    color: #6f7d8a;
    font-size: 0.92rem;
    position: relative;
    z-index: 1;
}

.stats-sections-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.85fr);
    gap: 1rem;
    align-items: start;
}

.stats-section-span-full {
    grid-column: 1 / -1;
}

.stats-section-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 0;
    border: 1px solid #e4edf5;
}

.stats-section-heading {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.stats-section-heading .card-header {
    margin-bottom: 0;
}

.stats-section-heading p {
    color: #617181;
    max-width: 760px;
}

.stats-section-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: #f2f7fb;
    color: #607180;
    font-size: 0.82rem;
    font-weight: 700;
}

.stats-section-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
    gap: 1rem;
    align-items: stretch;
}

.stats-overview-panel {
    border-radius: 20px;
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stats-accent-panel {
    color: white;
    box-shadow: 0 18px 34px rgba(44, 62, 80, 0.12);
}

.stats-accent-panel-tasks {
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 36%),
        linear-gradient(135deg, #2d88cf, #246bb0);
}

.stats-accent-panel-habits {
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 36%),
        linear-gradient(135deg, #1f9d63, #2ecc71);
}

.stats-overview-copy {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stats-overview-label {
    text-transform: uppercase;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    font-weight: 700;
    opacity: 0.86;
}

.stats-overview-copy strong {
    font-size: 2.35rem;
    line-height: 1;
}

.stats-overview-copy p {
    color: rgba(255, 255, 255, 0.88);
    max-width: 420px;
}

.stats-progress-track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    overflow: hidden;
}

.stats-progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.68));
}

.stats-mini-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.stats-mini-card {
    padding: 0.85rem 0.95rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.16);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stats-mini-card span {
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.82rem;
}

.stats-mini-card strong {
    font-size: 1.25rem;
}

.stats-meter-stack {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.stats-meter {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.stats-meter-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.92rem;
}

.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.stats-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.stats-detail-card {
    border: 1px solid #e7eef5;
    border-radius: 18px;
    padding: 1.1rem;
    background: linear-gradient(180deg, #fbfdff, #f7fbff);
    min-width: 0;
}

.stats-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.stats-detail-header h3 {
    color: var(--dark);
    font-size: 0.98rem;
}

.stats-detail-header span {
    color: #728292;
    font-size: 0.82rem;
    white-space: nowrap;
}

.stats-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.95rem 1rem;
    border: 1px solid #e7eef5;
    border-radius: 16px;
    background: #fbfdff;
    color: #52606d;
    min-width: 0;
}

.stats-summary-row span,
.stats-ranked-meta span,
.stats-spotlight-row span,
.stats-highlight-copy strong,
.stats-highlight-copy p,
.stats-insight-copy p,
.stats-empty-state p,
.stats-page-description,
.stats-section-heading p {
    overflow-wrap: anywhere;
}

.stats-summary-row strong {
    color: var(--dark);
    white-space: nowrap;
}

.stats-ranked-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.stats-ranked-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    background: #f2f7fb;
    color: #52606d;
}

.stats-ranked-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.stats-ranked-meta strong {
    color: var(--dark);
    white-space: nowrap;
}

.stats-ranked-bar {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(52, 152, 219, 0.12);
}

.stats-ranked-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #3498db, #2ecc71);
}

.stats-trend-chart {
    min-height: 190px;
    display: flex;
    align-items: end;
    gap: 0.45rem;
}

.stats-trend-column {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    min-width: 0;
}

.stats-trend-bar {
    width: 100%;
    min-height: 112px;
    display: flex;
    align-items: flex-end;
}

.stats-trend-bar span {
    display: block;
    width: 100%;
    min-height: 18px;
    border-radius: 999px 999px 8px 8px;
    background: linear-gradient(180deg, #2ecc71, #1f9d63);
}

.stats-trend-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    align-items: center;
    text-align: center;
    min-width: 0;
}

.stats-trend-meta span {
    color: #6f7d8a;
    font-size: 0.72rem;
    line-height: 1.2;
    word-break: break-word;
}

.stats-trend-meta strong {
    color: var(--dark);
    font-size: 0.78rem;
}

.stats-spotlight-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stats-spotlight-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 0.95rem;
    border-radius: 16px;
    background: #f2f7fb;
    color: #36526b;
}

.stats-spotlight-row small {
    display: block;
    color: #778796;
    font-size: 0.78rem;
    margin-top: 0.2rem;
}

.stats-spotlight-row strong {
    color: var(--dark);
    font-size: 1.1rem;
    white-space: nowrap;
}

.stats-theme-spotlight {
    margin-bottom: 0.25rem;
}

.stats-highlight-card {
    border-radius: 20px;
    padding: 1.2rem 1.25rem;
    background:
        radial-gradient(circle at top right, rgba(46, 204, 113, 0.14), transparent 30%),
        linear-gradient(135deg, #eff7ff, #f8fbff);
    border: 1px solid #dbeaf7;
}

.stats-highlight-copy {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stats-highlight-copy span {
    color: #607180;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.stats-highlight-copy strong {
    color: var(--dark);
    font-size: 1.5rem;
    line-height: 1.15;
}

.stats-highlight-copy p {
    color: #546271;
}

.stats-empty-state {
    grid-column: auto;
    display: flex;
    align-items: stretch;
    min-height: 180px;
    justify-content: center;
    padding: 0;
    margin: 0;
    background: linear-gradient(180deg, #f9fcff, #f4f9fd);
    border: 1px dashed #d9e7f3;
    border-radius: 18px;
}

.stats-empty-state-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    text-align: center;
    padding: 1.5rem;
    color: #5d6d7e;
}

.stats-empty-state-body i {
    font-size: 1.4rem;
    color: var(--primary-dark);
}

.stats-empty-state-body h4 {
    color: var(--dark);
    font-size: 1rem;
}

.stats-insight-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stats-insight {
    border-radius: 16px;
    padding: 1rem;
    border: 1px solid #d6e9f8;
    background: #f6fbff;
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
}

.stats-insight-icon {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(52, 152, 219, 0.12);
    color: var(--primary-dark);
    flex-shrink: 0;
}

.stats-insight-copy {
    min-width: 0;
}

.stats-insight h3 {
    margin-bottom: 0.35rem;
    color: var(--dark);
}

.stats-insight p {
    color: #52606d;
}

.stats-insight-success {
    background: #f2fbf5;
    border-color: #cdeed8;
}

.stats-insight-success .stats-insight-icon {
    background: rgba(46, 204, 113, 0.14);
    color: #1f8f57;
}

.stats-insight-warning {
    background: #fff8ef;
    border-color: #f6dfbe;
}

.stats-insight-warning .stats-insight-icon {
    background: rgba(243, 156, 18, 0.14);
    color: #c67607;
}

@media (max-width: 1100px) {
    .stats-sections-grid,
    .stats-section-layout,
    .stats-detail-grid {
        grid-template-columns: 1fr;
    }

    .stats-summary-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 0.8rem;
        align-items: flex-start;
    }

    .nav-menu {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .nav-user-dropdown {
        left: 0;
        right: auto;
    }

    .main-container-full {
        padding: 0.75rem;
    }

    .habits-page-grid {
        grid-template-columns: 1fr;
    }

    .habit-card {
        min-height: 0;
    }

    .habit-streak {
        font-size: 0.78rem;
        padding: 0.3rem 0.65rem;
    }

    .stats-page-header {
        flex-direction: column;
        gap: 1rem;
    }

    .stats-page-controls {
        align-items: stretch;
        width: 100%;
    }

    .stats-range-filter {
        width: 100%;
        justify-content: space-between;
    }

    .stats-range-link {
        flex: 1 1 0;
        text-align: center;
    }

    .stats-kpi-grid,
    .stats-mini-grid,
    .stats-summary-grid,
    .stats-detail-grid {
        grid-template-columns: 1fr;
    }

    .stats-detail-header,
    .stats-ranked-meta,
    .stats-spotlight-row,
    .stats-insight {
        align-items: flex-start;
    }

    .stats-detail-header,
    .stats-ranked-meta,
    .stats-spotlight-row {
        flex-direction: column;
    }

    .stats-trend-chart {
        gap: 0.3rem;
        min-height: 165px;
    }

    .stats-trend-bar {
        min-height: 96px;
    }

    .stats-trend-meta span {
        font-size: 0.65rem;
    }

    .stats-trend-column:nth-child(even) .stats-trend-meta span {
        opacity: 0.7;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.3rem;
        border-radius: 18px;
    }

    .habit-card-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .habit-actions {
        flex-wrap: wrap;
    }

    .habit-actions .btn-habit-edit,
    .habit-actions .btn-habit-complete {
        flex-basis: calc(50% - 0.25rem);
    }

    .habit-actions .btn-habit-delete {
        width: 100%;
        height: 38px;
    }
}
