:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --success-color: #4cc9f0;
    --danger-color: #f72585;
    --warning-color: #f8961e;
    --info-color: #4895ef;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --sidebar-width: 280px;
    --header-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fb;
    color: #333;
    overflow-x: hidden;
}

/* Сайдбар */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: linear-gradient(180deg, #1a237e, #0d47a1);
    color: white;
    padding: 20px 0;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 3px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-logo {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.sidebar-logo h2 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo i {
    color: #4cc9f0;
}

.sidebar-menu {
    padding: 0 10px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 500;
}

.sidebar-menu i {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* Контент */
.main-container {
    display: flex;
}

.content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    background-color: #f5f7fb;
}

/* Шапка */
.header {
    height: var(--header-height);
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 900;
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #212529;
}

.page-title small {
    display: block;
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 5px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 500;
    font-size: 1.05rem;
    color: #212529;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4361ee, #3f37c9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

/* Панель управления */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px 0;
}

.dashboard-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-title h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #212529;
}

.dashboard-title small {
    font-size: 1rem;
    color: #6c757d;
    font-weight: normal;
}

.date-filter {
    width: 280px;
}

/* Статистические карточки */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
    border-left: 4px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-color);
}

.stat-card-profit::before {
    background: #198754;
}

.stat-card-income::before {
    background: #0d6efd;
}

.stat-card-salary::before {
    background: #ffc107;
}

.stat-card-services::before {
    background: #6f42c1;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.stat-card-profit .stat-icon {
    background: rgba(25, 135, 84, 0.1);
    color: #198754;
}

.stat-card-income .stat-icon {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
}

.stat-card-salary .stat-icon {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.stat-card-services .stat-icon {
    background: rgba(111, 66, 193, 0.1);
    color: #6f42c1;
}

.stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.stat-comparison {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.comparison-up {
    color: #198754;
}

.comparison-down {
    color: #dc3545;
}

.comparison-neutral {
    color: #6c757d;
}

/* Графики */
.chart-section, .profit-chart {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.chart-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
}

.chart-header p {
    margin-top: 5px;
    font-size: 0.85rem;
}

.chart-controls {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.chart-control {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f1f5f9;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-control:hover {
    background: #e2e8f0;
    transform: scale(1.05);
}

.chart-container {
    position: relative;
    height: 300px;
}

.chart-legend {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #6c757d;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

/* Все операции */
.operations-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
}

.section-header p {
    margin-top: 5px;
    font-size: 0.85rem;
}

.filter-container {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.filter-btn {
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn.active {
    background: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

.filter-btn:hover {
    background: #e2e8f0;
}

.operations-table {
    width: 100%;
    border-collapse: collapse;
}

.operations-table th {
    background: #f8fafc;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.85rem;
    border-bottom: 1px solid #e2e8f0;
}

.operations-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.9rem;
}

.operations-table tr:last-child td {
    border-bottom: none;
}

.operation-income {
    color: #198754;
    font-weight: 500;
}

.operation-expense {
    color: #dc3545;
    font-weight: 500;
}

.no-data {
    text-align: center;
    padding: 30px 0;
    color: #94a3b8;
}

.no-data i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
    opacity: 0.3;
}

/* Модальные окна */
.modal-content {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    background: #f8fafc;
    border-bottom: 1px solid #edf2f7;
    padding: 15px 20px;
}

.modal-body {
    padding: 20px;
}

/* Футер */
.footer {
    text-align: center;
    padding: 20px 0;
    color: #6c757d;
    font-size: 0.85rem;
    border-top: 1px solid #eee;
    margin-top: 30px;
}

/* Адаптивность */
@media (max-width: 992px) {
    .sidebar {
        width: 70px;
    }
    
    .sidebar-logo h2, .sidebar-menu span, .user-info small {
        display: none;
    }
    
    .sidebar-menu i {
        margin-right: 0;
        font-size: 1.3rem;
    }
    
    .sidebar-menu a {
        justify-content: center;
        padding: 15px;
    }
    
    .content {
        margin-left: 70px;
        width: calc(100% - 70px);
    }
    
    .date-filter {
        width: 220px;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .date-filter {
        width: 100%;
    }
    
    .chart-legend {
        flex-wrap: wrap;
    }
    
    .sidebar-menu a span {
        display: none;
    }
}

@media (max-width: 576px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .date-filter {
        width: 100%;
    }
    
    .chart-header, .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .chart-controls, .filter-container {
        width: 100%;
        justify-content: space-between;
    }
}
:root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
}

/* Сайдбар */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: linear-gradient(180deg, #1a237e, #0d47a1);
    color: white;
    padding: 20px 0;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 3px 0 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto; /* Добавляем скролл при необходимости */
    overflow-x: hidden;
}

/* Добавляем скроллбар для длинного меню */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-logo {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.sidebar-logo h2 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.sidebar-logo i {
    color: #4cc9f0;
}

.sidebar-menu {
    padding: 0 10px;
    flex: 1;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    white-space: nowrap;
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 500;
}

.sidebar-menu i {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.sidebar-menu span {
    display: inline;
}

/* Контент */
.main-container {
    display: flex;
    min-height: 100vh;
}

.content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    background-color: #f5f7fb;
    transition: margin-left 0.3s ease;
}

/* Адаптивность */
@media (max-width: 992px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }
    
    .sidebar-logo h2, .sidebar-menu span, .user-info small {
        display: none;
    }
    
    .sidebar-menu i {
        margin-right: 0;
        font-size: 1.3rem;
    }
    
    .sidebar-menu a {
        justify-content: center;
        padding: 15px;
    }
    
    .content {
        margin-left: var(--sidebar-collapsed-width);
        width: calc(100% - var(--sidebar-collapsed-width));
    }
    
    .date-filter {
        width: 220px;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .date-filter {
        width: 100%;
    }
    
    .chart-legend {
        flex-wrap: wrap;
    }
    
    /* Всегда показываем полное меню на мобильных */
    .sidebar {
        width: var(--sidebar-width) !important;
        transform: translateX(-100%);
        z-index: 1001;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .mobile-menu-toggle {
        display: block;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1000;
        background: var(--primary-color);
        color: white;
        border: none;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
    }
}