/* Переменные */
:root {
    --primary: #3498db;
    --success: #27ae60;
    --error: #e74c3c;
    --warning: #f39c12;
    --neutral: #95a5a6;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --white: #ffffff;
    --border: #ddd;
    --shadow: rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --transition: 0.3s ease;
}

/* Глобальные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--dark);
    background: #f5f7fa;
    min-height: 100vh;
}

@media (max-width: 767px) {
    body {
        font-size: 16px;
    }
}

/* Контейнер */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

@media (max-width: 767px) {
    .container {
        padding: 15px;
    }
}

/* Заголовки */
h1 { font-size: 24px; margin-bottom: 20px; }
h2 { font-size: 20px; margin-bottom: 15px; }
h3 { font-size: 18px; margin-bottom: 10px; }

/* Header */
.header {
    background: var(--white);
    box-shadow: 0 2px 4px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    color: var(--dark);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    background: var(--light);
    color: var(--primary);
}

.nav-link.logout {
    color: var(--error);
}

/* Мобильное меню */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 3px;
    background: var(--dark);
    border-radius: 2px;
    transition: var(--transition);
}

@media (max-width: 767px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .nav {
        position: fixed;
        top: 60px;
        right: 0;
        background: var(--white);
        flex-direction: column;
        width: 250px;
        max-height: 0;
        overflow: hidden;
        box-shadow: 0 4px 6px var(--shadow);
        transition: max-height var(--transition);
        padding: 0;
    }
    
    .nav.active {
        max-height: 400px;
        padding: 20px;
    }
    
    .nav-link {
        width: 100%;
        display: block;
    }
}

/* Кнопки */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--radius);
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    text-align: center;
}

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

.btn-primary:hover {
    background: #2980b9;
}

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

.btn-secondary:hover {
    background: #7f8c8d;
}

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

.btn-income:hover {
    background: #229954;
}

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

.btn-expense:hover {
    background: #c0392b;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    transition: var(--transition);
}

.btn-icon:hover {
    transform: scale(1.2);
}

/* Алерты */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

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

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Страница авторизации */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary), #2980b9);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.auth-card {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

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

.auth-header h1 {
    color: var(--primary);
    margin-bottom: 10px;
}

.auth-header p {
    color: var(--neutral);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--neutral);
}

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

/* Формы */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
}

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

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--neutral);
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.form-actions .btn {
    flex: 1;
}

.form-card {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: 0 2px 4px var(--shadow);
}

/* Dashboard */
.dashboard {
    max-width: 900px;
    margin: 0 auto;
}

.balance-card {
    background: linear-gradient(135deg, var(--success), #229954);
    color: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: 0 4px 6px var(--shadow);
    margin-bottom: 30px;
}

.balance-card.negative {
    background: linear-gradient(135deg, var(--error), #c0392b);
}

.balance-content h2 {
    font-size: 18px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.balance-amount {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 20px;
}

.balance-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.balance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.balance-item .label {
    opacity: 0.9;
}

.balance-item .value {
    font-weight: 600;
    font-size: 16px;
}

/* Быстрые действия */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.quick-actions .btn {
    padding: 15px;
    font-size: 16px;
}

.quick-actions .icon {
    font-size: 20px;
    margin-right: 5px;
}

@media (max-width: 767px) {
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .balance-amount {
        font-size: 28px;
    }
}

/* Секции */
.section {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: 0 2px 4px var(--shadow);
    margin-bottom: 20px;
}

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

.recent-section {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: 0 2px 4px var(--shadow);
}

/* Транзакции */
.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-radius: var(--radius);
    background: var(--light);
    transition: var(--transition);
}

.transaction-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 4px var(--shadow);
}

.transaction-info {
    flex: 1;
}

.transaction-category {
    font-weight: 600;
    margin-bottom: 4px;
}

.transaction-date {
    font-size: 12px;
    color: var(--neutral);
}

.transaction-description {
    font-size: 13px;
    color: var(--neutral);
    margin-top: 4px;
}

.transaction-amount {
    font-size: 18px;
    font-weight: 700;
}

.transaction-amount.income {
    color: var(--success);
}

.transaction-amount.expense {
    color: var(--error);
}

/* Таблицы */
.table-responsive {
    overflow-x: auto;
    margin: 20px 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    background: var(--light);
}

.table tr:hover {
    background: #f9fafb;
}

.table .amount.income {
    color: var(--success);
    font-weight: 600;
}

.table .amount.expense {
    color: var(--error);
    font-weight: 600;
}

.table .actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 767px) {
    .table thead {
        display: none;
    }
    
    .table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
    }
    
    .table td {
        display: flex;
        justify-content: space-between;
        padding: 10px 15px;
        border: none;
    }
    
    .table td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 10px;
    }
    
    .table .actions {
        justify-content: flex-end;
    }
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.page-link {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--dark);
    transition: var(--transition);
}

.page-link:hover,
.page-link.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Категории */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 767px) {
    .categories-grid {
        grid-template-columns: 1fr;
    }
}

.category-section {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: 0 2px 4px var(--shadow);
}

.category-section h2 {
    margin-bottom: 15px;
}

.category-section h2.income {
    color: var(--success);
}

.category-section h2.expense {
    color: var(--error);
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--light);
    border-radius: var(--radius);
}

.category-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-name {
    font-weight: 500;
}

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

/* Бейджи */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    font-weight: 500;
}

.badge.system {
    background: var(--light);
    color: var(--neutral);
}

.badge.success {
    background: #d4edda;
    color: var(--success);
}

.badge.error {
    background: #f8d7da;
    color: var(--error);
}

.badge.warning {
    background: #fff3cd;
    color: var(--warning);
}

/* Статистика */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1023px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: 0 2px 4px var(--shadow);
}

.stat-label {
    font-size: 13px;
    color: var(--neutral);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-value.income {
    color: var(--success);
}

.stat-value.expense {
    color: var(--error);
}

.stat-value.small {
    font-size: 16px;
}

/* Хедер страницы */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

@media (max-width: 767px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-actions {
        display: flex;
        gap: 10px;
        width: 100%;
    }
    
    .header-actions .btn {
        flex: 1;
    }
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--neutral);
}

.empty-state p {
    margin-bottom: 10px;
}

/* Утилиты */
.text-muted {
    color: var(--neutral);
}

.link {
    color: var(--primary);
    text-decoration: none;
}

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

.income {
    color: var(--success);
}

.expense {
    color: var(--error);
}

/* ==================== ФИЛЬТРЫ И ПОИСК ==================== */

/* Панель фильтров */
.filters-panel {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: 0 2px 4px var(--shadow);
    margin-bottom: 20px;
}

.filters-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--dark);
}

.filter-group input,
.filter-group select {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
}

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

.filter-actions {
    display: flex;
    gap: 10px;
}

.filter-actions .btn {
    flex: 1;
}

/* Кнопка переключения фильтров на мобильных */
.filters-toggle-mobile {
    display: none;
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.filters-toggle-mobile:hover {
    background: #2980b9;
}

/* Информация о примененных фильтрах */
.filter-info {
    background: var(--light);
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

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

.filter-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary);
    color: var(--white);
    border-radius: 20px;
    font-size: 13px;
}

.filter-results {
    margin-left: auto;
    font-weight: 600;
    color: var(--primary);
}

/* Итоги по фильтрам */
.filter-totals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.total-item {
    background: var(--white);
    padding: 15px;
    border-radius: var(--radius);
    box-shadow: 0 2px 4px var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-item .label {
    font-size: 14px;
    color: var(--neutral);
}

.total-item .value {
    font-size: 18px;
    font-weight: 700;
}

.total-item.income .value {
    color: var(--success);
}

.total-item.expense .value {
    color: var(--error);
}

.total-item.balance .value.income {
    color: var(--success);
}

.total-item.balance .value.expense {
    color: var(--error);
}

/* Бейдж категории в таблице */
.category-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.category-badge.income {
    background: #d4edda;
    color: var(--success);
}

.category-badge.expense {
    background: #f8d7da;
    color: var(--error);
}

/* Улучшенная пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.page-link {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--dark);
    transition: var(--transition);
    font-size: 14px;
    min-width: 40px;
    text-align: center;
}

.page-link:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.page-link.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    font-weight: 600;
}

/* Мобильные стили для фильтров */
@media (max-width: 767px) {
    .filters-toggle-mobile {
        display: block;
    }
    
    .filters-panel.collapsed {
        display: none;
    }
    
    .filters-form {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        flex-direction: column;
    }
    
    .filter-actions .btn {
        width: 100%;
    }
    
    .filter-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-results {
        margin-left: 0;
        margin-top: 10px;
    }
    
    .filter-totals {
        grid-template-columns: 1fr;
    }
}

/* Планшетные стили для фильтров */
@media (min-width: 768px) and (max-width: 1023px) {
    .filters-form {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filter-totals {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Анимация загрузки */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.loading-shimmer {
    animation: shimmer 2s infinite;
    background: linear-gradient(
        to right,
        var(--light) 0%,
        #e0e0e0 50%,
        var(--light) 100%
    );
    background-size: 1000px 100%;
}

/* ==================== АНАЛИТИКА И ГРАФИКИ ==================== */

/* Селектор периода */
.period-selector {
    display: flex;
    gap: 10px;
}

.period-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.period-form select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
}

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

/* Сводка аналитики */
.analytics-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px var(--shadow);
}

.summary-card.income {
    border-left: 4px solid var(--success);
}

.summary-card.expense {
    border-left: 4px solid var(--error);
}

.summary-card.balance.positive {
    border-left: 4px solid var(--success);
}

.summary-card.balance.negative {
    border-left: 4px solid var(--error);
}

.summary-icon {
    font-size: 48px;
    line-height: 1;
}

.summary-content {
    flex: 1;
}

.summary-label {
    font-size: 13px;
    color: var(--neutral);
    margin-bottom: 5px;
}

.summary-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.summary-card.income .summary-value {
    color: var(--success);
}

.summary-card.expense .summary-value {
    color: var(--error);
}

.summary-card.balance.positive .summary-value {
    color: var(--success);
}

.summary-card.balance.negative .summary-value {
    color: var(--error);
}

.summary-count {
    font-size: 13px;
    color: var(--neutral);
}

/* Сетка графиков */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px var(--shadow);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light);
}

.chart-header h2 {
    font-size: 18px;
    margin: 0;
}

.chart-info {
    font-size: 13px;
    color: var(--neutral);
    background: var(--light);
    padding: 4px 10px;
    border-radius: 20px;
}

.chart-container {
    position: relative;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-container canvas {
    max-height: 100%;
}

.empty-chart {
    text-align: center;
    color: var(--neutral);
    padding: 40px 20px;
}

.empty-chart p {
    font-size: 16px;
}

/* Прогресс-бары */
.progress-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.progress-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.progress-rank {
    background: var(--primary);
    color: var(--white);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.progress-label {
    flex: 1;
    font-weight: 500;
}

.progress-value {
    font-weight: 700;
    color: var(--error);
}

.progress-bar-container {
    height: 20px;
    background: var(--light);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--error), #c0392b);
    border-radius: 10px;
    transition: width 1s ease;
}

/* Советы */
.analytics-tips {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px var(--shadow);
}

.analytics-tips h3 {
    margin-bottom: 20px;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.tip-card {
    background: var(--light);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
}

.tip-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.tip-card h4 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--dark);
}

.tip-card p {
    font-size: 14px;
    color: var(--neutral);
    line-height: 1.5;
}

/* Адаптивность для графиков */
@media (max-width: 1023px) {
    .analytics-summary {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .tips-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-card {
        padding: 20px;
    }
    
    .summary-icon {
        font-size: 36px;
    }
    
    .summary-value {
        font-size: 24px;
    }
}

@media (max-width: 767px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .period-selector {
        width: 100%;
    }
    
    .period-form {
        flex-direction: column;
        width: 100%;
    }
    
    .period-form select {
        width: 100%;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ==================== АНАЛИТИКА ПО ДНЯМ ==================== */

/* Полноширинная карточка графика */
.chart-full-width {
    grid-column: 1 / -1;
}

/* Увеличенный контейнер для графика по дням */
.chart-container-large {
    height: 400px;
}

/* Секция таблицы по дням */
.daily-table-section {
    margin-top: 30px;
}

.daily-table-section h3 {
    margin-bottom: 20px;
    color: var(--dark);
}

/* Таблица по дням */
.daily-table {
    font-size: 13px;
}

.daily-table tbody tr {
    transition: var(--transition);
}

.daily-table tbody tr:hover {
    background: #f0f8ff;
}

.daily-table tbody tr.weekend {
    background: #fff9e6;
}

.daily-table tbody tr.weekend:hover {
    background: #fff3cd;
}

.daily-table tbody tr.no-data {
    opacity: 0.5;
}

.daily-table .weekend-label {
    color: var(--warning);
    font-weight: 600;
}

.daily-table tfoot .total-row {
    background: var(--light);
    font-weight: 700;
}

.daily-table tfoot .total-row td {
    border-top: 3px solid var(--primary);
    padding: 15px 12px;
}

/* Статистика по дням */
.daily-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.daily-stat-card {
    background: var(--light);
    padding: 15px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 12px;
}

.daily-stat-card .stat-icon {
    font-size: 32px;
}

.daily-stat-card .stat-content {
    flex: 1;
}

.daily-stat-card .stat-label {
    font-size: 12px;
    color: var(--neutral);
    margin-bottom: 3px;
}

.daily-stat-card .stat-value {
    font-size: 16px;
    font-weight: 700;
}

/* Адаптивность для дневной статистики */
@media (max-width: 1200px) {
    .daily-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .chart-container-large {
        height: 300px;
    }
    
    .daily-stats {
        grid-template-columns: 1fr;
    }
    
    .daily-table {
        font-size: 12px;
    }
}

/* ==================== ЭКСПОРТ ==================== */

/* Dropdown меню экспорта */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-btn {
    cursor: pointer;
}

.export-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px var(--shadow);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

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

.export-item {
    display: block;
    padding: 12px 20px;
    color: var(--dark);
    text-decoration: none;
    transition: var(--transition);
    border-bottom: 1px solid var(--light);
}

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

.export-item:hover {
    background: var(--light);
    color: var(--primary);
}

/* Аналитика - header actions */
.header-actions-analytics {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px var(--shadow);
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 300px;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    background: var(--success);
    color: var(--white);
}

.notification-error {
    background: var(--error);
    color: var(--white);
}

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

/* Оверлей экспорта с прогресс-баром */
.export-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.export-progress {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    min-width: 400px;
    text-align: center;
}

.export-progress h3 {
    margin-bottom: 20px;
    color: var(--dark);
}

.progress-bar-wrapper {
    height: 30px;
    background: var(--light);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #2980b9);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    color: var(--neutral);
    font-size: 14px;
}

/* Кнопки с иконками */
.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-icon-left {
    font-size: 18px;
}

/* Адаптивность для экспорта */
@media (max-width: 767px) {
    .header-actions {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .header-actions .btn,
    .export-dropdown {
        width: 100%;
    }
    
    .export-btn {
        width: 100%;
    }
    
    .export-menu {
        left: 0;
        right: 0;
        width: 100%;
    }
    
    .notification {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .export-progress {
        min-width: auto;
        width: 90%;
        margin: 0 5%;
    }
    
    .header-actions-analytics {
        flex-direction: column;
        width: 100%;
    }
    
    .header-actions-analytics .btn {
        width: 100%;
    }
}

/* ==================== БЮДЖЕТЫ ==================== */

/* Сводка бюджетов */
.budgets-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* Сетка бюджетов */
.budgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Карточка бюджета */
.budget-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: var(--transition);
    position: relative;
    border-left: 4px solid var(--success);
}

.budget-card.near {
    border-left-color: var(--warning);
}

.budget-card.over {
    border-left-color: var(--error);
}

.budget-card.inactive {
    opacity: 0.6;
    background: var(--light);
}

.budget-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

/* Заголовок бюджета */
.budget-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--light);
}

.budget-title h3 {
    font-size: 18px;
    margin: 0 0 5px 0;
    color: var(--dark);
}

.budget-category {
    font-size: 13px;
    color: var(--neutral);
}

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

/* Период */
.budget-period {
    font-size: 13px;
    color: var(--neutral);
    margin-bottom: 15px;
}

/* Суммы */
.budget-amounts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.amount-item {
    text-align: center;
}

.amount-label {
    display: block;
    font-size: 11px;
    color: var(--neutral);
    margin-bottom: 3px;
}

.amount-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
}

/* Прогресс бюджета */
.budget-progress {
    margin-top: 15px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-percentage {
    font-size: 16px;
    font-weight: 700;
}

.progress-status {
    font-size: 13px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.progress-status.under {
    background: #d4edda;
    color: var(--success);
}

.progress-status.near {
    background: #fff3cd;
    color: var(--warning);
}

.progress-status.over {
    background: #f8d7da;
    color: var(--error);
}

.progress-bar-wrapper {
    position: relative;
    height: 20px;
    background: var(--light);
    border-radius: 10px;
    overflow: visible;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease;
}

.progress-bar-fill.under {
    background: linear-gradient(90deg, var(--success), #229954);
}

.progress-bar-fill.near {
    background: linear-gradient(90deg, var(--warning), #e67e22);
}

.progress-bar-fill.over {
    background: linear-gradient(90deg, var(--error), #c0392b);
}

/* Порог предупреждения */
.progress-threshold {
    position: absolute;
    top: -5px;
    bottom: -5px;
    width: 2px;
    background: var(--warning);
    z-index: 1;
}

.progress-threshold::before {
    content: '⚡';
    position: absolute;
    top: -20px;
    left: -8px;
    font-size: 16px;
}

/* Бейдж неактивного бюджета */
.budget-inactive-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--neutral);
    color: var(--white);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

/* Форма бюджета */
.budget-form .form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

/* Калькулятор бюджета */
.budget-calculator {
    margin-top: 15px;
    padding: 15px;
    background: var(--light);
    border-radius: var(--radius);
}

.budget-calculator h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--dark);
}

.calculator-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.calc-item {
    text-align: center;
}

.calc-label {
    display: block;
    font-size: 12px;
    color: var(--neutral);
    margin-bottom: 3px;
}

.calc-value {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

.threshold-value {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    font-weight: 500;
}

/* Виджет бюджетов на дашборде */
.budgets-widget {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: 0 2px 4px var(--shadow);
    margin-top: 30px;
}

.widget-budgets-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.widget-budget-item {
    padding: 15px;
    background: var(--light);
    border-radius: var(--radius);
    border-left: 3px solid var(--success);
}

.widget-budget-item.near {
    border-left-color: var(--warning);
}

.widget-budget-item.over {
    border-left-color: var(--error);
}

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

.widget-budget-name {
    font-weight: 600;
    font-size: 14px;
}

.widget-budget-percentage {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
}

.widget-budget-progress {
    margin-bottom: 8px;
}

.widget-progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.widget-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
}

.widget-progress-fill.under {
    background: var(--success);
}

.widget-progress-fill.near {
    background: var(--warning);
}

.widget-progress-fill.over {
    background: var(--error);
}

.widget-budget-amounts {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.widget-spent {
    font-weight: 600;
}

.widget-separator {
    color: var(--neutral);
}

.widget-limit {
    color: var(--neutral);
}

/* Уведомления о бюджетах */
.budget-alert {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px var(--shadow);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 350px;
}

.budget-alert.show {
    opacity: 1;
    transform: translateX(0);
}

.budget-alert-warning {
    background: var(--warning);
    color: var(--white);
}

.budget-alert-error {
    background: var(--error);
    color: var(--white);
}

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

.alert-message {
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Фильтры и сортировка бюджетов */
.budgets-filter-bar,
.budgets-sort-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.filter-btn:hover {
    background: var(--light);
}

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

.budgets-sort-bar label {
    font-weight: 500;
}

.budgets-sort-bar select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

/* Tooltip */
.budget-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.8);
    color: var(--white);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 10001;
    display: none;
}

/* Адаптивность для бюджетов */
@media (max-width: 1023px) {
    .budgets-grid {
        grid-template-columns: 1fr;
    }
    
    .budgets-summary {
        grid-template-columns: 1fr;
    }
    
    .budget-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .calculator-results {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .budget-amounts {
        grid-template-columns: 1fr;
    }
    
    .budget-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .budget-alert {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .budgets-filter-bar {
        gap: 5px;
    }
    
    .filter-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
}