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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    align-items: start;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.card h2 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 600;
}

.card h3 {
    color: #4a5568;
    margin-bottom: 16px;
    font-size: 1.2rem;
    font-weight: 500;
}

.formula-hint {
    background: #f0f4f8;
    border-left: 4px solid #667eea;
    padding: 8px 12px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: #4a5568;
    border-radius: 4px;
    font-style: italic;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #4a5568;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f8fafc;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

.input-group input[readonly] {
    background: #e2e8f0;
    color: #4a5568;
    cursor: not-allowed;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
    margin-right: 10px;
    margin-bottom: 10px;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

.items-list {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.empty-state {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    padding: 20px;
}

.item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: all 0.2s ease;
}

.item:hover {
    background: #edf2f7;
    transform: translateX(4px);
}

.item.expense {
    border-left-color: #f5576c;
}

.item.cogs {
    border-left-color: #ed8936;
}

.item.operating {
    border-left-color: #9f7aea;
}

.item.marketing {
    border-left-color: #38b2ac;
}

.item-description {
    font-weight: 500;
    color: #2d3748;
}

.item-category {
    font-size: 0.8rem;
    color: #718096;
    font-weight: 400;
}

.item-details {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 2px;
}

.item-amount {
    font-weight: 600;
    font-size: 1.1rem;
}

.item-amount.positive {
    color: #38a169;
}

.item-amount.negative {
    color: #e53e3e;
}

.delete-btn {
    background: #fed7d7;
    color: #c53030;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 10px;
    transition: background 0.2s ease;
}

.delete-btn:hover {
    background: #feb2b2;
}

.statement-card {
    position: sticky;
    top: 20px;
}

.expense-breakdown {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px;
    margin: 16px 0;
    border: 1px solid #e2e8f0;
}

.expense-breakdown .statement-row {
    padding: 8px 0;
    font-size: 1rem;
}

.statement-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    font-size: 1.1rem;
}

.statement-row.final-result {
    font-size: 1.3rem;
    font-weight: 700;
    padding: 16px 0;
}

.profit-margin {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 1rem;
    color: #4a5568;
    border-top: 1px solid #e2e8f0;
    margin-top: 8px;
    padding-top: 12px;
}

.label {
    color: #4a5568;
    font-weight: 500;
}

.amount {
    font-weight: 600;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.amount.positive {
    color: #38a169;
}

.amount.negative {
    color: #e53e3e;
}

.divider {
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    margin: 16px 0;
    border-radius: 1px;
}

.profit-indicator {
    margin-top: 24px;
    text-align: center;
}

.indicator-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
    transition: color 0.3s ease;
}

.indicator-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.indicator-fill {
    height: 100%;
    border-radius: 4px;
    transition: all 0.5s ease;
    background: linear-gradient(90deg, #38a169, #68d391);
}

.actions-card {
    margin-top: 20px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 24px;
}

.breakdown-section {
    margin-bottom: 24px;
}

.breakdown-section h3 {
    color: #2d3748;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}

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

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .input-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .statement-card {
        position: static;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .card {
        padding: 16px;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .btn-outline {
        margin-right: 0;
    }
}