:root {
    --primary-color: #4F46E5;
    --primary-dark: #3730A3;
    --secondary-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --background: #F9FAFB;
    --surface: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

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

h1 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo {
    font-size: 2rem;
}

.language-selector {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.language-selector:hover {
    border-color: var(--primary-color);
}

main {
    padding: 2rem 0;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.card h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.amount.positive {
    color: var(--secondary-color);
}

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

.income-card .amount {
    color: var(--secondary-color);
}

.expense-card .amount {
    color: var(--danger-color);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

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

.input-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.tab-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.tab-button:hover {
    color: var(--primary-color);
}

.tab-button.active {
    color: var(--primary-color);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.input-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.input-form input,
.input-form select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.input-form input:focus,
.input-form select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

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

.items-list {
    max-height: 400px;
    overflow-y: auto;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.list-item:hover {
    background: var(--background);
}

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

.item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-name {
    font-weight: 500;
    color: var(--text-primary);
}

.item-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--background);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

.item-budget {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.item-budget.over-budget {
    color: var(--danger-color);
    font-weight: 500;
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.item-amount {
    font-weight: 600;
    color: var(--text-primary);
}

.item-amount.over-budget {
    color: var(--danger-color);
}

.btn-delete {
    padding: 0.25rem 0.75rem;
    background: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: var(--danger-color);
    color: white;
}

.charts-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chart-container {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.chart-container h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.chart-container canvas {
    max-height: 300px;
}

.prediction-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.prediction-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.prediction-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.prediction-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.budget-warnings {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.budget-warning-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.budget-warning-item.safe {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary-color);
}

.budget-warning-item.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.budget-warning-item.over-budget {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.savings-detail {
    padding: 1rem;
    background: var(--background);
    border-radius: var(--radius);
}

.savings-detail h4 {
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.savings-detail p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.savings-detail p.positive {
    color: var(--secondary-color);
    font-weight: 500;
}

.savings-detail p.negative {
    color: var(--danger-color);
    font-weight: 500;
}

@media (max-width: 640px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .tab-button {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    
    h1 {
        font-size: 1.25rem;
    }
    
    .amount {
        font-size: 1.5rem;
    }
}