:root {
    --primary-color: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
    --gray-color: #6b7280;
    --light-gray: #e5e7eb;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f3f4f6;
    color: var(--dark-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background-color: white;
    box-shadow: var(--box-shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: transform 0.3s ease-in-out;
}

.header-hidden {
    transform: translateY(-100%);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
}

nav a {
    text-decoration: none;
    color: var(--gray-color);
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

nav a:hover, nav a.active {
    color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.1);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.dashboard {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 20px;
    margin-top: 30px;
}

.sidebar {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
    height: fit-content;
}

.sidebar h3 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--light-gray);
    color: var(--dark-color);
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 10px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--gray-color);
    transition: var(--transition);
    width: 100%;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.sidebar-menu a i {
    width: 20px;
    text-align: center;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.stat-card.income {
    border-top: 4px solid var(--success-color);
}

.stat-card.expense {
    border-top: 4px solid var(--danger-color);
}

.stat-card.balance {
    border-top: 4px solid var(--primary-color);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--gray-color);
    margin-bottom: 10px;
}

.stat-card .amount {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-card .change {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.change.positive {
    color: var(--success-color);
}

.change.negative {
    color: var(--danger-color);
}

.chart-container {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
    height: 400px;
    display: flex;
    flex-direction: column;
}

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

.chart-header h2 {
    font-size: 1.2rem;
    color: var(--dark-color);
}

.chart-actions select {
    padding: 8px 12px;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    background-color: white;
    cursor: pointer;
}

.chart-placeholder {
    height: 300px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
}

#incomeExpenseChart {
    height: 300px !important;
    max-height: 300px !important;
    flex-shrink: 0;
}

.recent-transactions {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
}

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

.transactions-header h2 {
    font-size: 1.2rem;
    color: var(--dark-color);
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

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

.btn-outline-primary {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

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

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

.btn-success:hover {
    background-color: #059669;
    color: white;
}

.transactions-list {
    width: 100%;
    border-collapse: collapse;
}

.transactions-list th {
    text-align: left;
    padding: 12px 15px;
    background-color: var(--light-color);
    font-weight: 600;
    color: var(--gray-color);
    border-bottom: 2px solid var(--light-gray);
}

.transactions-list td {
    padding: 15px;
    border-bottom: 1px solid var(--light-gray);
}

.transactions-list tr:last-child td {
    border-bottom: none;
}

.transaction-category {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.category-income {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.category-expense {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

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

.transaction-amount.expense {
    color: var(--danger-color);
    font-weight: 600;
}

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

.action-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.edit-btn {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.edit-btn:hover {
    background-color: rgba(59, 130, 246, 0.2);
}

.delete-btn {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.delete-btn:hover {
    background-color: rgba(239, 68, 68, 0.2);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.action-card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.action-link {
    text-decoration: none;
    color: inherit;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.action-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 1.5rem;
    color: white;
}

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

.expense-icon {
    background-color: var(--danger-color);
}

.transfer-icon {
    background-color: var(--warning-color);
}

.budget-icon {
    background-color: var(--info-color);
}

.action-card h3 {
    margin-bottom: 10px;
    color: var(--dark-color);
}

.action-card p {
    color: var(--gray-color);
    font-size: 0.9rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0.375rem;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}

.form-control:focus {
    color: #212529;
    background-color: #fff;
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13,110,253,.25);
}

.form-label {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border: 1px solid rgba(0,0,0,.125);
    border-radius: 0.375rem;
}

.card-body {
    flex: 1 1 auto;
    padding: 1rem 1rem;
}

.card-title {
    margin-bottom: 0.5rem;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,.075)!important;
}

.mt-5 {
    margin-top: 3rem!important;
}

.d-grid {
    display: grid!important;
}

.gap-2 {
    gap: 0.5rem!important;
}

.text-center {
    text-align: center!important;
}

.text-danger {
    color: #dc3545!important;
}

.alert {
    position: relative;
    padding: 1rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
}

.alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.alert-dismissible {
    padding-right: 3rem;
}

.btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: 0.25em 0.25em;
    color: #000;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
    border: 0;
    border-radius: 0.375rem;
    opacity: 0.5;
}

.fade {
    transition: opacity 0.15s linear;
}

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

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

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

    .quick-actions {
        grid-template-columns: 1fr 1fr;
    }
    .header {
        position: static;
        top: auto;
        z-index: auto;
        transition: none; /* или position: relative; — в зависимости от макета */
    }
}

@media (max-width: 480px) {
    .quick-actions {
        grid-template-columns: 1fr;
    }

    .transactions-list th:nth-child(3),
    .transactions-list td:nth-child(3) {
        display: none;
    }
}

/* Стиль для сообщения "Нет данных" */
.no-data-message {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 300px;
    font-size: 18px;
    color: #666;
    text-align: center;
}

#chartData {
    flex-shrink: 0;
/* Footer Styles */
.footer {
    background-color: #1f2937;
    color: white;
    padding: 40px 0 20px;
    margin-top: 40px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-info {
    text-align: center;
    margin-bottom: 20px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.footer-links a {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: white;
}

.footer-copyright {
    text-align: center;
    color: #9ca3af;
    font-size: 0.9rem;
    padding-top: 20px;
    border-top: 1px solid #374151;
    width: 100%;
}

@media (max-width: 768px) {
    .footer-links {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}
}